diff --git a/src/client/auth.rs b/src/client/auth.rs index 1953dad..7d933a4 100644 --- a/src/client/auth.rs +++ b/src/client/auth.rs @@ -60,7 +60,7 @@ impl ClientAuth { let name = mech.name().to_owned(); if mech_names.iter().any(|name1| *name1 == name) { println!("SASL mechanism selected: {:?}", name); - let initial = try!(mech.initial()); + let initial = mech.initial()?; let mut this = ClientAuth { state: ClientAuthState::Invalid, mechanism: mech, @@ -111,7 +111,7 @@ impl Future for ClientAuth { match stream.poll() { Ok(Async::Ready(Some(Packet::Stanza(stanza)))) => { if let Ok(challenge) = Challenge::try_from(stanza.clone()) { - let response = try!(self.mechanism.response(&challenge.data)); + let response = self.mechanism.response(&challenge.data)?; self.send(stream, Response { data: response }); self.poll() } else if let Ok(_) = Success::try_from(stanza.clone()) { diff --git a/src/client/mod.rs b/src/client/mod.rs index 95b9242..4f633eb 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -45,7 +45,7 @@ impl Client { /// Start polling the returned instance so that it will connect /// and yield events. pub fn new(jid: &str, password: &str, handle: Handle) -> Result { - let jid = try!(Jid::from_str(jid)); + let jid = Jid::from_str(jid)?; let password = password.to_owned(); let connect = Self::make_connect(jid.clone(), password.clone(), handle); Ok(Client { diff --git a/src/component/mod.rs b/src/component/mod.rs index 21ef897..9536f0a 100644 --- a/src/component/mod.rs +++ b/src/component/mod.rs @@ -42,7 +42,7 @@ impl Component { /// Start polling the returned instance so that it will connect /// and yield events. pub fn new(jid: &str, password: &str, server: &str, port: u16, handle: Handle) -> Result { - let jid = try!(Jid::from_str(jid)); + let jid = Jid::from_str(jid)?; let password = password.to_owned(); let connect = Self::make_connect(jid.clone(), password, server, port, handle); Ok(Component { diff --git a/src/happy_eyeballs.rs b/src/happy_eyeballs.rs index f2cd1a6..2d83301 100644 --- a/src/happy_eyeballs.rs +++ b/src/happy_eyeballs.rs @@ -18,14 +18,10 @@ pub struct Connecter { impl Connecter { pub fn from_lookup(handle: Handle, domain: &str, srv: &str, fallback_port: u16) -> Result { - let domain = try!( - DNameBuf::from_str(domain) - .map_err(|e| format!("{}", e)) - ); - let srv = try!( - DNameBuf::from_str(srv) - .map_err(|e| format!("{}", e)) - ); + let domain = DNameBuf::from_str(domain) + .map_err(|e| format!("{}", e))?; + let srv = DNameBuf::from_str(srv) + .map_err(|e| format!("{}", e))?; let resolver = Resolver::new(&handle); let lookup = lookup_srv(resolver.clone(), srv, domain, fallback_port);