From 9891cc48ac31d22ea801eb465796a6b6be1bbf1d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 11 Oct 2021 15:35:27 +0200 Subject: [PATCH] jid: Fix the issues reported by clippy --- jid/src/lib.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/jid/src/lib.rs b/jid/src/lib.rs index dd5f734..5b4f486 100644 --- a/jid/src/lib.rs +++ b/jid/src/lib.rs @@ -260,11 +260,11 @@ impl From<&BareJid> for String { } } -impl Into for FullJid { - fn into(self) -> BareJid { +impl From for BareJid { + fn from(full: FullJid) -> BareJid { BareJid { - node: self.node, - domain: self.domain, + node: full.node, + domain: full.domain, } } } @@ -333,7 +333,7 @@ fn _from_str(s: &str) -> Result { ParserState::Node => { match c { '@' => { - if buf == "" { + if buf.is_empty() { return Err(JidParseError::EmptyNode); } state = ParserState::Domain; @@ -341,7 +341,7 @@ fn _from_str(s: &str) -> Result { buf.clear(); } '/' => { - if buf == "" { + if buf.is_empty() { return Err(JidParseError::NoDomain); } state = ParserState::Resource; @@ -356,7 +356,7 @@ fn _from_str(s: &str) -> Result { ParserState::Domain => { match c { '/' => { - if buf == "" { + if buf.is_empty() { return Err(JidParseError::NoDomain); } state = ParserState::Resource; @@ -683,9 +683,9 @@ impl IntoAttributeValue for Jid { } #[cfg(feature = "minidom")] -impl Into for Jid { - fn into(self) -> Node { - Node::Text(String::from(self)) +impl From for Node { + fn from(jid: Jid) -> Node { + Node::Text(String::from(jid)) } } @@ -697,9 +697,9 @@ impl IntoAttributeValue for FullJid { } #[cfg(feature = "minidom")] -impl Into for FullJid { - fn into(self) -> Node { - Node::Text(String::from(self)) +impl From for Node { + fn from(jid: FullJid) -> Node { + Node::Text(String::from(jid)) } } @@ -711,9 +711,9 @@ impl IntoAttributeValue for BareJid { } #[cfg(feature = "minidom")] -impl Into for BareJid { - fn into(self) -> Node { - Node::Text(String::from(self)) +impl From for Node { + fn from(jid: BareJid) -> Node { + Node::Text(String::from(jid)) } }