From 956193e0daa217a780360683fbf13f621adc6ef6 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 12 Jun 2019 16:29:55 +0200 Subject: [PATCH] Fix all bare_trait_objects warnings, and deny them. --- src/client/auth.rs | 6 +++--- src/client/mod.rs | 2 +- src/component/mod.rs | 2 +- src/error.rs | 2 +- src/lib.rs | 2 +- src/xmpp_codec.rs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/client/auth.rs b/src/client/auth.rs index d961f7a0..81210dc7 100644 --- a/src/client/auth.rs +++ b/src/client/auth.rs @@ -16,12 +16,12 @@ use crate::{AuthError, Error, ProtocolError}; const NS_XMPP_SASL: &str = "urn:ietf:params:xml:ns:xmpp-sasl"; pub struct ClientAuth { - future: Box, Error = Error>>, + future: Box, Error = Error>>, } impl ClientAuth { pub fn new(stream: XMPPStream, creds: Credentials) -> Result { - let local_mechs: Vec Box>> = vec![ + let local_mechs: Vec Box>> = vec![ Box::new(|| Box::new(Scram::::from_credentials(creds.clone()).unwrap())), Box::new(|| Box::new(Scram::::from_credentials(creds.clone()).unwrap())), Box::new(|| Box::new(Plain::from_credentials(creds.clone()).unwrap())), @@ -62,7 +62,7 @@ impl ClientAuth { Err(AuthError::NoMechanism)? } - fn handle_challenge(stream: XMPPStream, mut mechanism: Box) -> Box, Error = Error>> { + fn handle_challenge(stream: XMPPStream, mut mechanism: Box) -> Box, Error = Error>> { Box::new( stream.into_future() .map_err(|(e, _stream)| e.into()) diff --git a/src/client/mod.rs b/src/client/mod.rs index 99965dc8..37085788 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -33,7 +33,7 @@ const NS_JABBER_CLIENT: &str = "jabber:client"; enum ClientState { Invalid, Disconnected, - Connecting(Box>), + Connecting(Box>), Connected(XMPPStream), } diff --git a/src/component/mod.rs b/src/component/mod.rs index cfc1ee5e..87381117 100644 --- a/src/component/mod.rs +++ b/src/component/mod.rs @@ -30,7 +30,7 @@ const NS_JABBER_COMPONENT_ACCEPT: &str = "jabber:component:accept"; enum ComponentState { Invalid, Disconnected, - Connecting(Box>), + Connecting(Box>), Connected(XMPPStream), } diff --git a/src/error.rs b/src/error.rs index 375c5178..d8b2063d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -59,7 +59,7 @@ impl StdError for ParseError { fn description(&self) -> &str { self.0.as_ref() } - fn cause(&self) -> Option<&StdError> { + fn cause(&self) -> Option<&dyn StdError> { None } } diff --git a/src/lib.rs b/src/lib.rs index bfed02a5..07ae8784 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![deny(unsafe_code, unused, missing_docs)] +#![deny(unsafe_code, unused, missing_docs, bare_trait_objects)] //! XMPP implementation with asynchronous I/O using Tokio. diff --git a/src/xmpp_codec.rs b/src/xmpp_codec.rs index 482cd786..3920ba41 100644 --- a/src/xmpp_codec.rs +++ b/src/xmpp_codec.rs @@ -219,7 +219,7 @@ impl Decoder for XMPPCodec { type Error = ParserError; fn decode(&mut self, buf: &mut BytesMut) -> Result, Self::Error> { - let buf1: Box> = if !self.buf.is_empty() && !buf.is_empty() { + let buf1: Box> = if !self.buf.is_empty() && !buf.is_empty() { let mut prefix = std::mem::replace(&mut self.buf, vec![]); prefix.extend_from_slice(buf.take().as_ref()); Box::new(prefix)