Upgrade to Rust 2021

This commit is contained in:
Jonas Platte 2022-05-27 12:04:23 +02:00
parent a796b5e54d
commit 5f902851af
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
70 changed files with 42 additions and 134 deletions

View File

@ -8,7 +8,7 @@ name = "ruma-appservice-api"
readme = "README.md"
repository = "https://github.com/ruma/ruma"
version = "0.6.0"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -8,7 +8,7 @@ name = "ruma-client-api"
readme = "README.md"
repository = "https://github.com/ruma/ruma"
version = "0.14.0"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,7 +1,6 @@
use std::{
borrow::Cow,
collections::btree_map::{BTreeMap, Entry},
convert::TryFrom,
fmt,
time::Duration,
};

View File

@ -1,5 +1,5 @@
//! Endpoints for push notifications.
use std::{convert::TryFrom, error::Error, fmt};
use std::{error::Error, fmt};
use ruma_common::{
push::{

View File

@ -1,7 +1,7 @@
[package]
categories = ["api-bindings", "web-programming"]
description = "A Matrix client library."
edition = "2018"
edition = "2021"
homepage = "https://www.ruma.io/"
keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"

View File

@ -1,4 +1,4 @@
use std::{convert::TryInto, mem};
use std::mem;
use async_trait::async_trait;
use bytes::{Bytes, BytesMut};

View File

@ -65,7 +65,6 @@
//! # .homeserver_url(homeserver_url)
//! # .build::<ruma_client::http_client::Dummy>()
//! # .await?;
//! use std::convert::TryFrom;
//!
//! use ruma_client_api::alias::get_alias;
//! use ruma_common::{api::MatrixVersion, room_alias_id, room_id};

View File

@ -7,7 +7,7 @@ keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/ruma/ruma"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,5 +1,4 @@
use std::{
convert::TryFrom,
fmt::{self, Display},
str::FromStr,
};

View File

@ -2,7 +2,7 @@
//!
//! [MSC3246]: https://github.com/matrix-org/matrix-spec-proposals/pull/3246
use std::{convert::TryFrom, time::Duration};
use std::time::Duration;
use js_int::UInt;
use ruma_macros::EventContent;

View File

@ -1,7 +1,5 @@
//! `Serialize` and `Deserialize` implementations for extensible events (MSC1767).
use std::convert::TryFrom;
use serde::Deserialize;
use super::{Amplitude, Waveform, WaveformError};

View File

@ -2,8 +2,6 @@
//!
//! [MSC3488]: https://github.com/matrix-org/matrix-spec-proposals/pull/3488
use std::convert::TryFrom;
use js_int::UInt;
use ruma_macros::{EventContent, StringEnum};
use serde::{Deserialize, Serialize};

View File

@ -49,7 +49,7 @@
//! [MSC3245]: https://github.com/matrix-org/matrix-spec-proposals/pull/3245
//! [MSC3381]: https://github.com/matrix-org/matrix-spec-proposals/pull/3381
//! [`RoomMessageEventContent`]: super::room::message::RoomMessageEventContent
use std::{convert::TryFrom, ops::Deref};
use std::ops::Deref;
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};

View File

@ -1,7 +1,5 @@
//! `Serialize` and `Deserialize` implementations for extensible events (MSC1767).
use std::convert::TryFrom;
use serde::{ser::SerializeStruct, Deserialize, Serialize};
use super::{MessageContent, Text, TryFromExtensibleError};

View File

@ -17,8 +17,6 @@ pub struct PolicyRuleRoomEventContent(pub PolicyRuleEventContent);
#[cfg(test)]
mod tests {
use std::convert::TryInto;
use js_int::int;
use serde_json::{from_value as from_json_value, json, to_value as to_json_value};

View File

@ -1,7 +1,5 @@
//! Types for the [`m.poll.start`] event.
use std::convert::TryFrom;
use js_int::{uint, UInt};
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};

View File

@ -1,7 +1,5 @@
//! `Serialize` and `Deserialize` implementations for extensible events (MSC1767).
use std::convert::TryFrom;
use serde::Deserialize;
use super::{PollAnswer, PollAnswers, PollAnswersError};

View File

@ -28,8 +28,6 @@ impl RoomNameEventContent {
#[cfg(test)]
mod tests {
use std::convert::TryInto;
use assert_matches::assert_matches;
use js_int::{int, uint};
use serde_json::{from_value as from_json_value, json, to_value as to_json_value};

View File

@ -27,8 +27,6 @@ impl RoomPinnedEventsEventContent {
#[cfg(all(test, feature = "rand"))]
mod tests {
use std::convert::TryInto;
use super::RoomPinnedEventsEventContent;
use crate::{
events::{EmptyStateKey, OriginalStateEvent, StateUnsigned},

View File

@ -2,8 +2,6 @@
//!
//! [`m.secret.request`]: https://spec.matrix.org/v1.2/client-server-api/#msecretrequest
use std::convert::TryFrom;
use ruma_macros::EventContent;
use serde::{ser::SerializeStruct, Deserialize, Serialize};

View File

@ -4,8 +4,6 @@
// FIXME: Remove once lint doesn't trigger on std::convert::TryFrom in identifiers/macros.rs anymore
#![allow(unused_qualifications)]
use std::convert::TryFrom;
use serde::de::{self, Deserializer, Unexpected};
#[doc(inline)]

View File

@ -30,8 +30,6 @@ impl ClientSecret {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::ClientSecret;
#[test]

View File

@ -41,8 +41,6 @@ impl DeviceKeyId {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::{DeviceKeyId, OwnedDeviceKeyId};
use crate::identifiers::{crypto_algorithms::DeviceKeyAlgorithm, IdParseError};

View File

@ -19,7 +19,6 @@ use super::ServerName;
/// format.
///
/// ```
/// # use std::convert::TryFrom;
/// # use ruma_common::EventId;
/// // Original format
/// assert_eq!(<&EventId>::try_from("$h29iv0s8:example.com").unwrap(), "$h29iv0s8:example.com");
@ -78,8 +77,6 @@ impl EventId {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::{EventId, OwnedEventId};
use crate::IdParseError;

View File

@ -1,6 +1,6 @@
//! Matrix URIs.
use std::{convert::TryFrom, fmt, str::FromStr};
use std::{fmt, str::FromStr};
use percent_encoding::{percent_decode_str, percent_encode, AsciiSet, CONTROLS};
use ruma_identifiers_validation::{

View File

@ -61,8 +61,6 @@ impl MxcUri {
#[cfg(test)]
mod tests {
use std::convert::TryInto;
use ruma_identifiers_validation::error::MxcUriError;
use super::{MxcUri, OwnedMxcUri};

View File

@ -10,7 +10,6 @@ use super::{matrix_uri::UriAction, server_name::ServerName, EventId, MatrixToUri
/// needed.
///
/// ```
/// # use std::convert::TryFrom;
/// # use ruma_common::RoomAliasId;
/// assert_eq!(<&RoomAliasId>::try_from("#ruma:example.com").unwrap(), "#ruma:example.com");
/// ```
@ -61,8 +60,6 @@ impl RoomAliasId {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::{OwnedRoomAliasId, RoomAliasId};
use crate::IdParseError;

View File

@ -10,7 +10,6 @@ use super::{matrix_uri::UriAction, EventId, MatrixToUri, MatrixUri, ServerName};
/// into a string as needed.
///
/// ```
/// # use std::convert::TryFrom;
/// # use ruma_common::RoomId;
/// assert_eq!(<&RoomId>::try_from("!n8f893n9:example.com").unwrap(), "!n8f893n9:example.com");
/// ```
@ -110,8 +109,6 @@ impl RoomId {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::{OwnedRoomId, RoomId};
use crate::IdParseError;

View File

@ -1,6 +1,6 @@
//! Matrix identifiers for places where a room ID or room alias ID are used interchangeably.
use std::{convert::TryFrom, hint::unreachable_unchecked};
use std::hint::unreachable_unchecked;
use ruma_macros::IdZst;
@ -13,7 +13,6 @@ use super::{server_name::ServerName, OwnedRoomAliasId, OwnedRoomId, RoomAliasId,
/// string slice, the variant is determined by the leading sigil character.
///
/// ```
/// # use std::convert::TryFrom;
/// # use ruma_common::RoomOrAliasId;
/// assert_eq!(<&RoomOrAliasId>::try_from("#ruma:example.com").unwrap(), "#ruma:example.com");
///
@ -144,8 +143,6 @@ impl TryFrom<OwnedRoomOrAliasId> for OwnedRoomAliasId {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::{OwnedRoomOrAliasId, RoomOrAliasId};
use crate::IdParseError;

View File

@ -1,6 +1,6 @@
//! Matrix room version identifiers.
use std::{cmp::Ordering, convert::TryFrom, str::FromStr};
use std::{cmp::Ordering, str::FromStr};
use ruma_macros::DisplayAsRefStr;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
@ -13,7 +13,6 @@ use super::IdParseError;
/// or serialized back into a string as needed.
///
/// ```
/// # use std::convert::TryFrom;
/// # use ruma_common::RoomVersionId;
/// assert_eq!(RoomVersionId::try_from("1").unwrap().as_ref(), "1");
/// ```
@ -246,8 +245,6 @@ impl AsRef<str> for CustomRoomVersion {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::RoomVersionId;
use crate::IdParseError;

View File

@ -53,8 +53,6 @@ impl ServerName {
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::ServerName;
#[test]

View File

@ -10,7 +10,6 @@ use super::{matrix_uri::UriAction, IdParseError, MatrixToUri, MatrixUri, ServerN
/// into a string as needed.
///
/// ```
/// # use std::convert::TryFrom;
/// # use ruma_common::UserId;
/// assert_eq!(<&UserId>::try_from("@carl:example.com").unwrap(), "@carl:example.com");
/// ```
@ -155,8 +154,6 @@ use ruma_macros::IdZst;
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::{OwnedUserId, UserId};
use crate::{server_name, IdParseError};

View File

@ -1,4 +1,4 @@
use std::{collections::BTreeMap, convert::TryFrom, ops::RangeBounds, str::FromStr};
use std::{collections::BTreeMap, ops::RangeBounds, str::FromStr};
use js_int::{Int, UInt};
use serde::{Deserialize, Serialize};

View File

@ -1,4 +1,4 @@
use std::{convert::TryInto, fmt};
use std::fmt;
use serde::Serialize;
use serde_json::{Error as JsonError, Value as JsonValue};
@ -43,7 +43,7 @@ pub fn to_canonical_value<T: Serialize>(value: T) -> Result<value::CanonicalJson
#[cfg(test)]
mod tests {
use std::{collections::BTreeMap, convert::TryInto};
use std::collections::BTreeMap;
use js_int::int;
use serde_json::{from_str as from_json_str, json, to_string as to_json_string};

View File

@ -1,8 +1,4 @@
use std::{
collections::BTreeMap,
convert::{TryFrom, TryInto},
fmt,
};
use std::{collections::BTreeMap, fmt};
use js_int::Int;
use serde::{de::Deserializer, ser::Serializer, Deserialize, Serialize};
@ -21,7 +17,6 @@ pub enum CanonicalJsonValue {
///
/// ```
/// # use serde_json::json;
/// # use std::convert::TryInto;
/// # use ruma_common::serde::CanonicalJsonValue;
/// let v: CanonicalJsonValue = json!(null).try_into().unwrap();
/// ```
@ -31,7 +26,6 @@ pub enum CanonicalJsonValue {
///
/// ```
/// # use serde_json::json;
/// # use std::convert::TryInto;
/// # use ruma_common::serde::CanonicalJsonValue;
/// let v: CanonicalJsonValue = json!(true).try_into().unwrap();
/// ```
@ -41,7 +35,6 @@ pub enum CanonicalJsonValue {
///
/// ```
/// # use serde_json::json;
/// # use std::convert::TryInto;
/// # use ruma_common::serde::CanonicalJsonValue;
/// let v: CanonicalJsonValue = json!(12).try_into().unwrap();
/// ```
@ -51,7 +44,6 @@ pub enum CanonicalJsonValue {
///
/// ```
/// # use serde_json::json;
/// # use std::convert::TryInto;
/// # use ruma_common::serde::CanonicalJsonValue;
/// let v: CanonicalJsonValue = json!("a string").try_into().unwrap();
/// ```
@ -61,7 +53,6 @@ pub enum CanonicalJsonValue {
///
/// ```
/// # use serde_json::json;
/// # use std::convert::TryInto;
/// # use ruma_common::serde::CanonicalJsonValue;
/// let v: CanonicalJsonValue = json!(["an", "array"]).try_into().unwrap();
/// ```
@ -73,7 +64,6 @@ pub enum CanonicalJsonValue {
///
/// ```
/// # use serde_json::json;
/// # use std::convert::TryInto;
/// # use ruma_common::serde::CanonicalJsonValue;
/// let v: CanonicalJsonValue = json!({ "an": "object" }).try_into().unwrap();
/// ```
@ -316,8 +306,6 @@ impl<'de> Deserialize<'de> for CanonicalJsonValue {
#[cfg(test)]
mod tests {
use std::convert::TryInto;
use serde_json::json;
use super::CanonicalJsonValue;

View File

@ -3,7 +3,7 @@
//!
//! Delegates to `js_int::UInt` to ensure integer size is within bounds.
use std::{convert::TryFrom, time::Duration};
use std::time::Duration;
use js_int::UInt;
use serde::{

View File

@ -3,7 +3,7 @@
//!
//! Delegates to `js_int::UInt` to ensure integer size is within bounds.
use std::{convert::TryFrom, time::Duration};
use std::time::Duration;
use js_int::UInt;
use serde::{

View File

@ -1,4 +1,4 @@
use std::{collections::BTreeMap, convert::TryInto, fmt, marker::PhantomData};
use std::{collections::BTreeMap, fmt, marker::PhantomData};
use js_int::{Int, UInt};
use serde::{

View File

@ -291,8 +291,6 @@ impl From<ThirdPartyIdentifierInit> for ThirdPartyIdentifier {
#[cfg(test)]
mod tests {
use std::convert::TryInto;
use serde_json::{from_value as from_json_value, json, to_value as to_json_value};
use super::{Medium, ThirdPartyIdentifier};

View File

@ -1,7 +1,4 @@
use std::{
convert::TryInto,
time::{Duration, SystemTime, UNIX_EPOCH},
};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use js_int::{uint, UInt};
use serde::{Deserialize, Serialize};
@ -83,7 +80,6 @@ impl SecondsSinceUnixEpoch {
#[cfg(all(target_arch = "wasm32", target_os = "unknown", feature = "js"))]
fn f64_to_uint(val: f64) -> UInt {
use std::convert::TryFrom;
// UInt::MAX milliseconds is ~285 616 years, we do not account for that
// (or for dates before the unix epoch which would have to be negative)
UInt::try_from(val as u64).expect("date out of range")

View File

@ -2,10 +2,7 @@
//!
//! [send-to-device]: https://spec.matrix.org/v1.2/client-server-api/#send-to-device-messaging
use std::{
convert::TryFrom,
fmt::{Display, Formatter, Result as FmtResult},
};
use std::fmt::{Display, Formatter, Result as FmtResult};
use serde::{
de::{self, Unexpected},

View File

@ -1,5 +1,3 @@
use std::convert::TryFrom;
use assert_matches::assert_matches;
use ruma_common::{
events::{AnyInitialStateEvent, InitialStateEvent},

View File

@ -1,7 +1,5 @@
#![cfg(feature = "unstable-msc1767")]
use std::convert::TryFrom;
use assert_matches::assert_matches;
use assign::assign;
use js_int::uint;

View File

@ -1,6 +1,6 @@
#![cfg(all(feature = "unstable-pdu"))]
use std::{collections::BTreeMap, convert::TryInto};
use std::collections::BTreeMap;
use js_int::uint;
use ruma_common::{

View File

@ -1,7 +1,5 @@
#![cfg(feature = "unstable-msc3381")]
use std::convert::TryInto;
use assert_matches::assert_matches;
use assign::assign;
use js_int::uint;

View File

@ -1,5 +1,3 @@
use std::convert::TryFrom;
use js_int::uint;
use ruma_common::{
events::{

View File

@ -1,7 +1,7 @@
[package]
categories = ["api-bindings", "web-programming"]
description = "Types for the endpoints in the Matrix server-server API."
edition = "2018"
edition = "2021"
homepage = "https://www.ruma.io/"
keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"

View File

@ -5,7 +5,7 @@ homepage = "https://www.ruma.io/"
repository = "https://github.com/ruma/ruma"
license = "MIT"
version = "0.8.1"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -7,7 +7,7 @@ keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/ruma/ruma"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,7 +1,7 @@
[package]
categories = ["api-bindings", "web-programming"]
description = "Procedural macros used by the Ruma crates."
edition = "2018"
edition = "2021"
homepage = "https://www.ruma.io/"
keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"

View File

@ -1,7 +1,4 @@
use std::{
collections::{BTreeMap, BTreeSet},
convert::{TryFrom, TryInto},
};
use std::collections::{BTreeMap, BTreeSet};
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};

View File

@ -1,7 +1,4 @@
use std::{
convert::{TryFrom, TryInto},
ops::Not,
};
use std::ops::Not;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};

View File

@ -1,4 +1,4 @@
use std::{convert::TryInto, num::NonZeroU8};
use std::num::NonZeroU8;
use proc_macro2::TokenStream;
use quote::{format_ident, quote, ToTokens};

View File

@ -7,7 +7,7 @@ keywords = ["matrix", "chat", "messaging", "ruma"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/ruma/ruma"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,7 +1,7 @@
[package]
categories = ["api-bindings", "cryptography"]
description = "Digital signatures according to the Matrix specification."
edition = "2018"
edition = "2021"
homepage = "https://www.ruma.io/"
keywords = ["matrix", "chat", "messaging", "ruma", "cryptography"]
license = "MIT"

View File

@ -3,7 +3,6 @@
use std::{
borrow::Cow,
collections::{BTreeMap, BTreeSet},
convert::TryFrom,
mem,
};
@ -876,10 +875,7 @@ fn is_third_party_invite(object: &CanonicalJsonObject) -> Result<bool, Error> {
#[cfg(test)]
mod tests {
use std::{
collections::BTreeMap,
convert::{TryFrom, TryInto},
};
use std::collections::BTreeMap;
use ruma_common::{
serde::{Base64, CanonicalJsonValue},

View File

@ -1,7 +1,5 @@
//! Verification of digital signatures.
use std::convert::TryInto;
use ed25519_dalek::{PublicKey, Verifier as _};
use crate::{Error, ParseError, VerificationError};

View File

@ -8,7 +8,7 @@ repository = "https://github.com/ruma/ruma"
readme = "README.md"
license = "MIT"
version = "0.7.0"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -10,7 +10,6 @@
use std::{
borrow::Borrow,
collections::{HashMap, HashSet},
convert::TryInto,
sync::{
atomic::{AtomicU64, Ordering::SeqCst},
Arc,

View File

@ -1,4 +1,4 @@
use std::{borrow::Borrow, collections::BTreeSet, convert::TryFrom};
use std::{borrow::Borrow, collections::BTreeSet};
use js_int::{int, Int};
use ruma_common::{

View File

@ -1,7 +1,6 @@
use std::{
borrow::Borrow,
collections::{BTreeMap, HashMap, HashSet},
convert::TryInto,
sync::{
atomic::{AtomicU64, Ordering::SeqCst},
Arc,

View File

@ -8,7 +8,7 @@ repository = "https://github.com/ruma/ruma"
readme = "README.md"
license = "MIT"
version = "0.6.2"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,7 +1,7 @@
[package]
name = "hello_isahc"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@ -1,4 +1,4 @@
use std::{convert::TryFrom, env, process::exit};
use std::{env, process::exit};
use ruma::{
api::client::{alias::get_alias, membership::join_room_by_id, message::send_message_event},

View File

@ -1,7 +1,7 @@
[package]
name = "hello_world"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@ -1,4 +1,4 @@
use std::{convert::TryFrom, env, process::exit};
use std::{env, process::exit};
use ruma::{
api::client::{alias::get_alias, membership::join_room_by_id, message::send_message_event},

View File

@ -1,7 +1,7 @@
[package]
name = "joke_bot"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@ -1,4 +1,4 @@
use std::{convert::TryInto, error::Error, io, process::exit, time::Duration};
use std::{error::Error, io, process::exit, time::Duration};
use futures_util::future::{join, join_all};
use ruma::{

View File

@ -1,7 +1,7 @@
[package]
name = "message_log"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "xtask"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false
[features]