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 6ddde6f7..36ed320c 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 f47715c1..80ba863f 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 1910c8c1..a2af3a9c 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 7693c05c..e5c09d2a 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 8ded3e6a..1d509638 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 74e84bc6..b44c4111 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 b1c59b0e..d8b5a9cc 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 452fa6d5..e5e998b1 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 2bf2d1b1..d7ae1e37 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 4ab78c57..a0588177 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 296614e9..323e91ed 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 80f92edd..97a32d25 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 87145208..9d8781dc 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 36e55c2c..d408b28d 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 20623ff2..623a0cd1 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 5dfa4aea..4adb4796 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 e1be62b1..f4b19faa 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 aa1e07d3..8a81b651 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 c98c9093..911b8002 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 89b62c05..cba3698b 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 bca785e9..c5a195d4 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 9edb318f..ed4fe4a8 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 84f64650..e65c3681 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 3cd9e00a..f0b7cf32 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 019f0342..d1fe61f9 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 3b386705..32301438 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 8561a649..bf0478cf 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 366cfeec..108010d0 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 02b97361..0aa79721 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 eb3cc3b4..38546ace 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 cc606923..bd97ed99 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 259e9d12..f632e48c 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 29708c32..582c7f1a 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 b2600e0b..1055af9b 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 da07bf50..8d27c4f0 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 898af678..5428a602 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 8965529f..bc8012d6 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 1fbeb102..07f07f77 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 62bd0b1a..f110088b 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 c6a1a102..de2b77c3 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 8f6951d9..5d65eb78 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 5093b3e1..0e166bd3 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 e6090040..3b54d3cd 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 57d440e9..65c1fdf5 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 6b65e3b4..a4f97365 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 ec84fe6c..3deed9e1 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 53cef383..3ad9e000 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 661d05b9..b4835140 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 dcaf5cb8..f2ae500e 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 dd8ed9e0..2178d7a9 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 a77a73ea..1d4715f2 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 f4b08335..010cde52 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 5aa4d2fb..afc61789 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 03a1d040..b8c02e2b 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]