From 5bf14b0b22f0020463de381179c71f4b57f75a6e Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 12 Apr 2019 10:58:42 +0200 Subject: [PATCH] Drop dependency on try_from. This bumps the minimum supported stable Rust version to 1.34. The TryFrom and TryInto traits are still reexported to not break the API, but these reexports are deprecated and will be removed in a future release. --- Cargo.toml | 1 - examples/generate-caps.rs | 2 +- src/attention.rs | 2 +- src/avatar.rs | 2 +- src/bind.rs | 4 ++-- src/blocking.rs | 4 ++-- src/bookmarks.rs | 2 +- src/caps.rs | 4 ++-- src/chatstates.rs | 2 +- src/component.rs | 2 +- src/data_forms.rs | 6 +++--- src/delay.rs | 2 +- src/disco.rs | 4 ++-- src/ecaps2.rs | 2 +- src/eme.rs | 2 +- src/forwarding.rs | 2 +- src/hashes.rs | 2 +- src/ibb.rs | 2 +- src/ibr.rs | 4 ++-- src/idle.rs | 2 +- src/iq.rs | 4 ++-- src/jingle.rs | 6 +++--- src/jingle_dtls_srtp.rs | 2 +- src/jingle_ft.rs | 8 ++++---- src/jingle_ibb.rs | 2 +- src/jingle_ice_udp.rs | 2 +- src/jingle_message.rs | 4 ++-- src/jingle_rtp.rs | 2 +- src/jingle_s5b.rs | 4 ++-- src/lib.rs | 2 +- src/mam.rs | 4 ++-- src/media_element.rs | 2 +- src/message.rs | 4 ++-- src/message_correct.rs | 2 +- src/mood.rs | 2 +- src/muc/muc.rs | 2 +- src/muc/user.rs | 4 ++-- src/nick.rs | 2 +- src/ping.rs | 2 +- src/presence.rs | 4 ++-- src/pubsub/event.rs | 4 ++-- src/pubsub/pubsub.rs | 6 +++--- src/receipts.rs | 2 +- src/roster.rs | 2 +- src/rsm.rs | 6 +++--- src/sasl.rs | 6 +++--- src/server_info.rs | 4 ++-- src/sm.rs | 2 +- src/stanza_error.rs | 4 ++-- src/stanza_id.rs | 2 +- src/stream.rs | 2 +- src/util/macros.rs | 22 +++++++++++----------- src/version.rs | 2 +- src/websocket.rs | 2 +- 54 files changed, 91 insertions(+), 92 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6ddde6f7b94773886e02ca0577893fdf43865699..36ed320c4e0249f5a33d6830a166d41688366258 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ sha2 = "0.8" sha3 = "0.8" blake2 = "0.8" chrono = "0.4.5" -try_from = "0.3.2" [features] # Build xmpp-parsers to make components instead of clients. diff --git a/examples/generate-caps.rs b/examples/generate-caps.rs index f47715c1e6d7dd4f46871fd856e676b2e561c263..80ba863f12be8e5f9f229638966fef8ac1d8f800 100644 --- a/examples/generate-caps.rs +++ b/examples/generate-caps.rs @@ -4,10 +4,10 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +use std::convert::TryFrom; use std::io::{self, Read}; use std::env; use xmpp_parsers::{ - TryFrom, Element, disco::DiscoInfoResult, caps::{Caps, compute_disco as compute_disco_caps, hash_caps}, diff --git a/src/attention.rs b/src/attention.rs index 1910c8c13bf75657512b3db9b07c6e549bed0f89..a2af3a9cd79a9be54cef033e5b7468da397c1ccc 100644 --- a/src/attention.rs +++ b/src/attention.rs @@ -21,7 +21,7 @@ mod tests { #[cfg(not(feature = "disable-validation"))] use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[test] fn test_size() { diff --git a/src/avatar.rs b/src/avatar.rs index 7693c05c16ea954eb90e8ce6ddad287ef8a81d8a..e5c09d2a14957737c50a266ced9db2d1f25be35f 100644 --- a/src/avatar.rs +++ b/src/avatar.rs @@ -60,7 +60,7 @@ mod tests { use crate::hashes::Algo; use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/bind.rs b/src/bind.rs index 8ded3e6ac10c8bb01e61ba9bb0d3c56b1f1d4d24..1d509638c8fb0545f80a996bcc81a4d8f652e69b 100644 --- a/src/bind.rs +++ b/src/bind.rs @@ -10,7 +10,7 @@ use crate::ns; use jid::Jid; use minidom::Element; use std::str::FromStr; -use try_from::TryFrom; +use std::convert::TryFrom; /// The request for resource binding, which is the process by which a client /// can obtain a full JID and start exchanging on the XMPP network. @@ -43,7 +43,7 @@ impl IqSetPayload for Bind {} impl IqResultPayload for Bind {} impl TryFrom for Bind { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "bind", BIND); diff --git a/src/blocking.rs b/src/blocking.rs index 74e84bc6f46d44921c832c643f4d702ce694a4ad..b44c4111936b1c2af458f09bc8383c2a01f6351a 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -9,7 +9,7 @@ use crate::iq::{IqGetPayload, IqResultPayload, IqSetPayload}; use crate::ns; use jid::Jid; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; generate_empty_element!( /// The element requesting the blocklist, the result iq will contain a @@ -31,7 +31,7 @@ macro_rules! generate_blocking_element { } impl TryFrom for $elem { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result<$elem, Error> { check_self!(elem, $name, BLOCKING); diff --git a/src/bookmarks.rs b/src/bookmarks.rs index b1c59b0e40d0372921eeb082ac29caa42d4c1116..d8b5a9ccc1bbce7141144df5ca699ef1e2bd9754 100644 --- a/src/bookmarks.rs +++ b/src/bookmarks.rs @@ -72,7 +72,7 @@ mod tests { use super::*; use crate::util::compare_elements::NamespaceAwareCompare; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/caps.rs b/src/caps.rs index 452fa6d56acfd8920e73916a0eab3a101f57db14..e5e998b1df7561085baa580473f576030cd1c0af 100644 --- a/src/caps.rs +++ b/src/caps.rs @@ -17,7 +17,7 @@ use minidom::Element; use sha1::Sha1; use sha2::{Sha256, Sha512}; use sha3::{Sha3_256, Sha3_512}; -use try_from::TryFrom; +use std::convert::TryFrom; /// Represents a capability hash for a given client. #[derive(Debug, Clone)] @@ -40,7 +40,7 @@ pub struct Caps { impl PresencePayload for Caps {} impl TryFrom for Caps { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "c", CAPS, "caps"); diff --git a/src/chatstates.rs b/src/chatstates.rs index 2bf2d1b1fe0cbd91cc4803101bb941d03add554a..d7ae1e37d8a6dbe94bdf41b76ae6351a4da26b1b 100644 --- a/src/chatstates.rs +++ b/src/chatstates.rs @@ -35,7 +35,7 @@ mod tests { use crate::util::error::Error; use crate::ns; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[test] fn test_size() { diff --git a/src/component.rs b/src/component.rs index 4ab78c57c28bf9ffba5ad50cd4bf9588c69fad8b..a0588177fecc45c3c133b319ea4d2fb8238bdcef 100644 --- a/src/component.rs +++ b/src/component.rs @@ -44,7 +44,7 @@ impl Handshake { mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/data_forms.rs b/src/data_forms.rs index 296614e975dfd118707a93e2c0d9e45e8ccf742f..323e91ed091b7411dc1a2eb82e40b28fc4357853 100644 --- a/src/data_forms.rs +++ b/src/data_forms.rs @@ -8,7 +8,7 @@ use crate::util::error::Error; use crate::media_element::MediaElement; use crate::ns; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; generate_element!( /// Represents one of the possible values for a list- field. @@ -100,7 +100,7 @@ impl Field { } impl TryFrom for Field { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "field", DATA_FORMS); @@ -215,7 +215,7 @@ pub struct DataForm { } impl TryFrom for DataForm { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "x", DATA_FORMS); diff --git a/src/delay.rs b/src/delay.rs index 80f92edd00eb8b8023d8920df551de550493bed8..97a32d2598933c069a0215d152e42ae5ae4b93c4 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -35,7 +35,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::str::FromStr; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/disco.rs b/src/disco.rs index 87145208d96aeb819e913eb7ed8a7981665bf718..9d8781dcdb95d99ae78f7178b68e6620c5e66fba 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -10,7 +10,7 @@ use crate::iq::{IqGetPayload, IqResultPayload}; use crate::ns; use jid::Jid; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; generate_element!( /// Structure representing a `` element. @@ -115,7 +115,7 @@ pub struct DiscoInfoResult { impl IqResultPayload for DiscoInfoResult {} impl TryFrom for DiscoInfoResult { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "query", DISCO_INFO, "disco#info result"); diff --git a/src/ecaps2.rs b/src/ecaps2.rs index 36e55c2c34f6069bc5444664b9c836191369ee8e..d408b28de48f1ccc74c09ad074e0322b35b278b0 100644 --- a/src/ecaps2.rs +++ b/src/ecaps2.rs @@ -176,7 +176,7 @@ mod tests { use super::*; use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/eme.rs b/src/eme.rs index 20623ff2f2b628ed56310bb8d1110d6df20ead6d..623a0cd1eb1378c6b24a9fb55e15eb72ee633167 100644 --- a/src/eme.rs +++ b/src/eme.rs @@ -26,7 +26,7 @@ mod tests { use super::*; use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/forwarding.rs b/src/forwarding.rs index 5dfa4aea0413a754808f3ddbbf4f1601ac85c76e..4adb47964422e79070a494dcb8b1264c567e7ced 100644 --- a/src/forwarding.rs +++ b/src/forwarding.rs @@ -28,7 +28,7 @@ mod tests { use super::*; use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/hashes.rs b/src/hashes.rs index e1be62b1ceb967a7517f563a4814b6aaca109e44..f4b19faad26f62324286715e220194fcd66af5f5 100644 --- a/src/hashes.rs +++ b/src/hashes.rs @@ -168,7 +168,7 @@ impl Deref for Sha1HexAttribute { mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/ibb.rs b/src/ibb.rs index aa1e07d3c2308cd767defbec47be9e80d72f3fd9..8a81b651826903733a271e3aab7c9953302ace4d 100644 --- a/src/ibb.rs +++ b/src/ibb.rs @@ -75,7 +75,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::error::Error as StdError; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/ibr.rs b/src/ibr.rs index c98c909369c4ba1a25e52ae603c6e7b59584b28c..911b800228b76fe5b2038b1e0198df01e3ae9e1a 100644 --- a/src/ibr.rs +++ b/src/ibr.rs @@ -10,7 +10,7 @@ use crate::iq::{IqGetPayload, IqResultPayload, IqSetPayload}; use crate::ns; use minidom::Element; use std::collections::HashMap; -use try_from::TryFrom; +use std::convert::TryFrom; /// Query for registering against a service. #[derive(Debug, Clone)] @@ -36,7 +36,7 @@ impl IqSetPayload for Query {} impl IqResultPayload for Query {} impl TryFrom for Query { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "query", REGISTER, "IBR query"); diff --git a/src/idle.rs b/src/idle.rs index 89b62c0549f139c4832ea5feafbf9dc77efbe5e3..cba3698b4db829c20cc6afd7232cd7cef1d7e07b 100644 --- a/src/idle.rs +++ b/src/idle.rs @@ -25,7 +25,7 @@ mod tests { use minidom::Element; use std::error::Error as StdError; use std::str::FromStr; - use try_from::TryFrom; + use std::convert::TryFrom; #[test] fn test_size() { diff --git a/src/iq.rs b/src/iq.rs index bca785e90af177b7f351c55ea368056ce3913335..c5a195d404b68001960cb65b2edc20791a79c1fe 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -11,7 +11,7 @@ use crate::stanza_error::StanzaError; use jid::Jid; use minidom::Element; use minidom::IntoAttributeValue; -use try_from::TryFrom; +use std::convert::TryFrom; /// Should be implemented on every known payload of an ``. pub trait IqGetPayload: TryFrom + Into {} @@ -130,7 +130,7 @@ impl Iq { } impl TryFrom for Iq { - type Err = Error; + type Error = Error; fn try_from(root: Element) -> Result { check_self!(root, "iq", DEFAULT_NS); diff --git a/src/jingle.rs b/src/jingle.rs index 9edb318ff43b5903366fc0b1ee7c7186ac708c72..ed4fe4a8609e920d87f99e4b28c0a92b610986d1 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -11,7 +11,7 @@ use jid::Jid; use minidom::Element; use std::collections::BTreeMap; use std::str::FromStr; -use try_from::TryFrom; +use std::convert::TryFrom; generate_attribute!( /// The action attribute. @@ -368,7 +368,7 @@ pub struct ReasonElement { } impl TryFrom for ReasonElement { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "reason", JINGLE); @@ -497,7 +497,7 @@ impl Jingle { } impl TryFrom for Jingle { - type Err = Error; + type Error = Error; fn try_from(root: Element) -> Result { check_self!(root, "jingle", JINGLE, "Jingle"); diff --git a/src/jingle_dtls_srtp.rs b/src/jingle_dtls_srtp.rs index 84f646506b3ca265650c3f03e8816ae8dfce000d..e65c368170a229208e130dc0a9f4d8b4fb63449c 100644 --- a/src/jingle_dtls_srtp.rs +++ b/src/jingle_dtls_srtp.rs @@ -50,7 +50,7 @@ generate_element!( mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs index 3cd9e00abe7fdc94bc94ea778b36c40b1e812eb6..f0b7cf32461fe8e1982bc9a309f67f3fa3db5f74 100644 --- a/src/jingle_ft.rs +++ b/src/jingle_ft.rs @@ -12,7 +12,7 @@ use crate::ns; use minidom::Element; use std::collections::BTreeMap; use std::str::FromStr; -use try_from::TryFrom; +use std::convert::TryFrom; generate_element!( /// Represents a range in a file. @@ -128,7 +128,7 @@ impl File { } impl TryFrom for File { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "file", JINGLE_FT); @@ -253,7 +253,7 @@ pub struct Description { } impl TryFrom for Description { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "description", JINGLE_FT, "JingleFT description"); @@ -301,7 +301,7 @@ pub struct Checksum { } impl TryFrom for Checksum { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "checksum", JINGLE_FT); diff --git a/src/jingle_ibb.rs b/src/jingle_ibb.rs index 019f03429f520c8983b1f937b96ba4bf8b68a3e5..d1fe61f9d295271c6582a3285f3e178f32cccb70 100644 --- a/src/jingle_ibb.rs +++ b/src/jingle_ibb.rs @@ -27,7 +27,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::error::Error as StdError; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/jingle_ice_udp.rs b/src/jingle_ice_udp.rs index 3b386705362b9ee6cb545c29540f74263c5cb19e..323014380d89a17a26d30390ae96e337e58d075c 100644 --- a/src/jingle_ice_udp.rs +++ b/src/jingle_ice_udp.rs @@ -92,7 +92,7 @@ generate_element!( mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; use crate::hashes::Algo; use crate::jingle_dtls_srtp::Setup; diff --git a/src/jingle_message.rs b/src/jingle_message.rs index 8561a649b792a7d422ca10cb7380d6a2aafdf38a..bf0478cf4801aed8018eae1a115a7069ac3626a1 100644 --- a/src/jingle_message.rs +++ b/src/jingle_message.rs @@ -8,7 +8,7 @@ use crate::util::error::Error; use crate::jingle::SessionId; use crate::ns; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; /// Defines a protocol for broadcasting Jingle requests to all of the clients /// of a user. @@ -48,7 +48,7 @@ fn check_empty_and_get_sid(elem: Element) -> Result { } impl TryFrom for JingleMI { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { if !elem.has_ns(ns::JINGLE_MESSAGE) { diff --git a/src/jingle_rtp.rs b/src/jingle_rtp.rs index 366cfeeca4397a5e5d5d4cb4db12efb3b2b4141d..108010d00404ae87fdc3ccbf4086c146ed6660da 100644 --- a/src/jingle_rtp.rs +++ b/src/jingle_rtp.rs @@ -76,7 +76,7 @@ generate_element!( mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/jingle_s5b.rs b/src/jingle_s5b.rs index 02b97361352b517dc471c7e1816826370a9ab98a..0aa797211481d754a269176c9a86019754516659 100644 --- a/src/jingle_s5b.rs +++ b/src/jingle_s5b.rs @@ -9,7 +9,7 @@ use crate::ns; use jid::Jid; use minidom::Element; use std::net::IpAddr; -use try_from::TryFrom; +use std::convert::TryFrom; generate_attribute!( /// The type of the connection being proposed by this candidate. @@ -172,7 +172,7 @@ impl Transport { } impl TryFrom for Transport { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "transport", JINGLE_S5B); diff --git a/src/lib.rs b/src/lib.rs index eb3cc3b4aa52e818df45738a9f4a9fc058cca312..38546ace262a5aaaa1df7a9f206b48040b167e3b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ pub use minidom::Element; pub use jid::{Jid, JidParseError}; -pub use try_from::{TryFrom, TryInto}; +pub use std::convert::{TryFrom, TryInto}; pub use crate::util::error::Error; /// XML namespace definitions used through XMPP. diff --git a/src/mam.rs b/src/mam.rs index cc606923f19bc15fb9a2f59a658f6ff5c90f3386..bd97ed9902943262f05fc1ef94eabae70ac7cdb9 100644 --- a/src/mam.rs +++ b/src/mam.rs @@ -14,7 +14,7 @@ use crate::pubsub::NodeName; use crate::rsm::{SetQuery, SetResult}; use jid::Jid; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; generate_id!( /// An identifier matching a result message to the query requesting it. @@ -126,7 +126,7 @@ impl IqSetPayload for Prefs {} impl IqResultPayload for Prefs {} impl TryFrom for Prefs { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "prefs", MAM); diff --git a/src/media_element.rs b/src/media_element.rs index 259e9d1226d5a14336f2697c58a4b0113ddfdaa3..f632e48c13428c4e722e9871a62019f07d3f2b9b 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -49,7 +49,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::error::Error as StdError; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/message.rs b/src/message.rs index 29708c32e1d2e710ca27eda4790b6b0f6af7c0ac..582c7f1a70e7763d53c2748302b35b20e544e418 100644 --- a/src/message.rs +++ b/src/message.rs @@ -9,7 +9,7 @@ use crate::ns; use jid::Jid; use minidom::Element; use std::collections::BTreeMap; -use try_from::TryFrom; +use std::convert::TryFrom; /// Should be implemented on every known payload of a ``. pub trait MessagePayload: TryFrom + Into {} @@ -150,7 +150,7 @@ impl Message { } impl TryFrom for Message { - type Err = Error; + type Error = Error; fn try_from(root: Element) -> Result { check_self!(root, "message", DEFAULT_NS); diff --git a/src/message_correct.rs b/src/message_correct.rs index b2600e0b9a021f227b0bef80065fb83fa1778a9f..1055af9bd261bc0e3a9cb0b72c0a5996aab92fed 100644 --- a/src/message_correct.rs +++ b/src/message_correct.rs @@ -23,7 +23,7 @@ mod tests { use super::*; use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/mood.rs b/src/mood.rs index da07bf50a296d6a5190c56b6bc24cab306eb11ab..8d27c4f0629db50ff50675003532f7923535e4be 100644 --- a/src/mood.rs +++ b/src/mood.rs @@ -272,7 +272,7 @@ generate_elem_id!( mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/muc/muc.rs b/src/muc/muc.rs index 898af67896f657699516615e46d3fcaa50e7a8af..5428a60278e7cd220d10275ba89882f211ac3468 100644 --- a/src/muc/muc.rs +++ b/src/muc/muc.rs @@ -98,7 +98,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::str::FromStr; - use try_from::TryFrom; + use std::convert::TryFrom; #[test] fn test_muc_simple() { diff --git a/src/muc/user.rs b/src/muc/user.rs index 8965529fa9486a7629472c188634afb731fd8fa0..bc8012d6b90801239f25601358ed25578ac55eca 100644 --- a/src/muc/user.rs +++ b/src/muc/user.rs @@ -9,7 +9,7 @@ use crate::util::error::Error; use crate::ns; use jid::Jid; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; generate_attribute_enum!( /// Lists all of the possible status codes used in MUC presences. @@ -89,7 +89,7 @@ pub enum Actor { } impl TryFrom for Actor { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "actor", MUC_USER); diff --git a/src/nick.rs b/src/nick.rs index 1fbeb1026752abc44799299b2b271f1fa3f450f2..07f07f770125550a41cbd5e53674ff842f8586c1 100644 --- a/src/nick.rs +++ b/src/nick.rs @@ -17,7 +17,7 @@ mod tests { #[cfg(not(feature = "disable-validation"))] use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/ping.rs b/src/ping.rs index 62bd0b1a2e6c215f644864d43c277833ca84787a..f110088b33edf9a717437ba4b80bcdf2c522b226 100644 --- a/src/ping.rs +++ b/src/ping.rs @@ -23,7 +23,7 @@ mod tests { #[cfg(not(feature = "disable-validation"))] use crate::util::error::Error; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[test] fn test_size() { diff --git a/src/presence.rs b/src/presence.rs index c6a1a102974f2e2701e42d89318f9f821c3ca2fa..de2b77c37dd54423c79cceb436c5c24334d32d09 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -11,7 +11,7 @@ use jid::Jid; use minidom::{Element, ElementEmitter, IntoAttributeValue, IntoElements}; use std::collections::BTreeMap; use std::str::FromStr; -use try_from::TryFrom; +use std::convert::TryFrom; /// Should be implemented on every known payload of a ``. pub trait PresencePayload: TryFrom + Into {} @@ -259,7 +259,7 @@ impl Presence { } impl TryFrom for Presence { - type Err = Error; + type Error = Error; fn try_from(root: Element) -> Result { check_self!(root, "presence", DEFAULT_NS); diff --git a/src/pubsub/event.rs b/src/pubsub/event.rs index 8f6951d9e67081f62ffbfe630553868021b0d2f7..5d65eb783d9411505b26065f8aee07c25e476605 100644 --- a/src/pubsub/event.rs +++ b/src/pubsub/event.rs @@ -11,7 +11,7 @@ use crate::ns; use crate::pubsub::{ItemId, NodeName, Subscription, SubscriptionId, Item as PubSubItem}; use jid::Jid; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; /// Event wrapper for a PubSub ``. #[derive(Debug, Clone)] @@ -132,7 +132,7 @@ fn parse_items(elem: Element, node: NodeName) -> Result { } impl TryFrom for PubSubEvent { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "event", PUBSUB_EVENT); diff --git a/src/pubsub/pubsub.rs b/src/pubsub/pubsub.rs index 5093b3e1512e692bbd02f47f779e311944ebf0e6..0e166bd3ebcf86cd17e2327f864e5f53a0ba670f 100644 --- a/src/pubsub/pubsub.rs +++ b/src/pubsub/pubsub.rs @@ -11,7 +11,7 @@ use crate::ns; use crate::pubsub::{NodeName, Subscription, SubscriptionId, Item as PubSubItem}; use jid::Jid; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; // TODO: a better solution would be to split this into a query and a result elements, like for // XEP-0030. @@ -191,7 +191,7 @@ pub struct SubscribeOptions { } impl TryFrom for SubscribeOptions { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "subscribe-options", PUBSUB); @@ -340,7 +340,7 @@ impl IqSetPayload for PubSub {} impl IqResultPayload for PubSub {} impl TryFrom for PubSub { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "pubsub", PUBSUB); diff --git a/src/receipts.rs b/src/receipts.rs index e60900401ec1510473735441f10d17c24be516d3..3b54d3cddb1663a8c4084f15493c29ae12667393 100644 --- a/src/receipts.rs +++ b/src/receipts.rs @@ -33,7 +33,7 @@ mod tests { use super::*; use crate::ns; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/roster.rs b/src/roster.rs index 57d440e97733717d16ff33c86e9c16c8ee938235..65c1fdf57f593b6a927728dfb1a550c99241e62b 100644 --- a/src/roster.rs +++ b/src/roster.rs @@ -96,7 +96,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::str::FromStr; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/rsm.rs b/src/rsm.rs index 6b65e3b48d9cda6f193fb96005293f0cd4d46f1d..a4f97365388da78a6e47e3ebc7555afd0a2623f2 100644 --- a/src/rsm.rs +++ b/src/rsm.rs @@ -7,7 +7,7 @@ use crate::util::error::Error; use crate::ns; use minidom::Element; -use try_from::TryFrom; +use std::convert::TryFrom; /// Requests paging through a potentially big set of items (represented by an /// UID). @@ -29,7 +29,7 @@ pub struct SetQuery { } impl TryFrom for SetQuery { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "set", RSM, "RSM set"); @@ -116,7 +116,7 @@ pub struct SetResult { } impl TryFrom for SetResult { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "set", RSM, "RSM set"); diff --git a/src/sasl.rs b/src/sasl.rs index ec84fe6cb99df44fa0ea8cf9b76111239eca044b..3deed9e1aa6b0fface1dcd41319f8eafc96641c0 100644 --- a/src/sasl.rs +++ b/src/sasl.rs @@ -9,7 +9,7 @@ use crate::util::helpers::Base64; use crate::ns; use minidom::Element; use std::collections::BTreeMap; -use try_from::TryFrom; +use std::convert::TryFrom; generate_attribute!( /// The list of available SASL mechanisms. @@ -151,7 +151,7 @@ pub struct Failure { } impl TryFrom for Failure { - type Err = Error; + type Error = Error; fn try_from(root: Element) -> Result { check_self!(root, "failure", SASL); @@ -224,7 +224,7 @@ impl From for Element { mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/server_info.rs b/src/server_info.rs index 53cef3838bcd2cc55ad1e75de8827f8863183049..3ad9e0008786092f03391d6a1617095447ec54dc 100644 --- a/src/server_info.rs +++ b/src/server_info.rs @@ -6,7 +6,7 @@ use crate::data_forms::{DataForm, DataFormType, Field, FieldType}; use crate::ns; use crate::util::error::Error; -use try_from::TryFrom; +use std::convert::TryFrom; /// Structure representing a `http://jabber.org/network/serverinfo` form type. #[derive(Debug, Clone, PartialEq, Default)] @@ -31,7 +31,7 @@ pub struct ServerInfo { } impl TryFrom for ServerInfo { - type Err = Error; + type Error = Error; fn try_from(form: DataForm) -> Result { if form.type_ != DataFormType::Result_ { diff --git a/src/sm.rs b/src/sm.rs index 661d05b9d0c3f5f73e30a2a47cd8787f7dc84b28..b483514023031ca34bdf02fe07ddf1c75daacdfb 100644 --- a/src/sm.rs +++ b/src/sm.rs @@ -146,7 +146,7 @@ generate_empty_element!( mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/stanza_error.rs b/src/stanza_error.rs index dcaf5cb884f6146839ccf557426eef424cfa3960..f2ae500e2592ed59662542e9e20d839bd2c14e8c 100644 --- a/src/stanza_error.rs +++ b/src/stanza_error.rs @@ -11,7 +11,7 @@ use crate::presence::PresencePayload; use jid::Jid; use minidom::Element; use std::collections::BTreeMap; -use try_from::TryFrom; +use std::convert::TryFrom; generate_attribute!( /// The type of the error. @@ -236,7 +236,7 @@ impl StanzaError { } impl TryFrom for StanzaError { - type Err = Error; + type Error = Error; fn try_from(elem: Element) -> Result { check_self!(elem, "error", DEFAULT_NS); diff --git a/src/stanza_id.rs b/src/stanza_id.rs index dd8ed9e0a125044eb9587f5364793730f1a12127..2178d7a94014034f91b14f3d8c7d6859ed31265d 100644 --- a/src/stanza_id.rs +++ b/src/stanza_id.rs @@ -40,7 +40,7 @@ mod tests { use crate::util::error::Error; use minidom::Element; use std::str::FromStr; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/stream.rs b/src/stream.rs index a77a73ea8ca36f59a55df520e085aa29cf9dff85..1d4715f2d1c164cfc158500f12348bccfd808ab1 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -74,7 +74,7 @@ impl Stream { mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/util/macros.rs b/src/util/macros.rs index f4b08335fa29301d1d263e4315ea3938dfdfaa2a..010cde52bb48675b7ba8a43cbb2b45365c734923 100644 --- a/src/util/macros.rs +++ b/src/util/macros.rs @@ -230,8 +230,8 @@ macro_rules! generate_element_enum { $enum ),+ } - impl ::try_from::TryFrom<::minidom::Element> for $elem { - type Err = crate::util::error::Error; + impl ::std::convert::TryFrom<::minidom::Element> for $elem { + type Error = crate::util::error::Error; fn try_from(elem: ::minidom::Element) -> Result<$elem, crate::util::error::Error> { check_ns_only!(elem, $name, $ns); check_no_children!(elem, $name); @@ -269,8 +269,8 @@ macro_rules! generate_attribute_enum { $enum ),+ } - impl ::try_from::TryFrom<::minidom::Element> for $elem { - type Err = crate::util::error::Error; + impl ::std::convert::TryFrom<::minidom::Element> for $elem { + type Error = crate::util::error::Error; fn try_from(elem: ::minidom::Element) -> Result<$elem, crate::util::error::Error> { check_ns_only!(elem, $name, $ns); check_no_children!(elem, $name); @@ -367,8 +367,8 @@ macro_rules! generate_empty_element { #[derive(Debug, Clone)] pub struct $elem; - impl ::try_from::TryFrom<::minidom::Element> for $elem { - type Err = crate::util::error::Error; + impl ::std::convert::TryFrom<::minidom::Element> for $elem { + type Error = crate::util::error::Error; fn try_from(elem: ::minidom::Element) -> Result<$elem, crate::util::error::Error> { check_self!(elem, $name, $ns); @@ -420,8 +420,8 @@ macro_rules! generate_elem_id { Ok($elem(String::from(s))) } } - impl ::try_from::TryFrom<::minidom::Element> for $elem { - type Err = crate::util::error::Error; + impl ::std::convert::TryFrom<::minidom::Element> for $elem { + type Error = crate::util::error::Error; fn try_from(elem: ::minidom::Element) -> Result<$elem, crate::util::error::Error> { check_self!(elem, $name, $ns); check_no_children!(elem, $name); @@ -600,8 +600,8 @@ macro_rules! generate_element { )* } - impl ::try_from::TryFrom<::minidom::Element> for $elem { - type Err = crate::util::error::Error; + impl ::std::convert::TryFrom<::minidom::Element> for $elem { + type Error = crate::util::error::Error; fn try_from(elem: ::minidom::Element) -> Result<$elem, crate::util::error::Error> { check_self!(elem, $name, $ns); @@ -662,7 +662,7 @@ macro_rules! assert_size ( macro_rules! impl_pubsub_item { ($item:ident, $ns:ident) => { impl crate::TryFrom for $item { - type Err = Error; + type Error = Error; fn try_from(elem: crate::Element) -> Result<$item, Error> { check_self!(elem, "item", $ns); diff --git a/src/version.rs b/src/version.rs index 5aa4d2fbb2acbfe5e3d3d2e8207e57d43958a195..afc617897adf033e0dfd46865165e04af4e551f2 100644 --- a/src/version.rs +++ b/src/version.rs @@ -43,7 +43,7 @@ mod tests { use super::*; use crate::util::compare_elements::NamespaceAwareCompare; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test] diff --git a/src/websocket.rs b/src/websocket.rs index 03a1d0401b97103d42e81ba45f10f110dae3bea5..b8c02e2b44f736f76c9447e97d25ebcef6e16bcb 100644 --- a/src/websocket.rs +++ b/src/websocket.rs @@ -73,7 +73,7 @@ impl Open { mod tests { use super::*; use minidom::Element; - use try_from::TryFrom; + use std::convert::TryFrom; #[cfg(target_pointer_width = "32")] #[test]