jid: Fix the issues reported by clippy

This commit is contained in:
Emmanuel Gil Peyrot 2021-10-11 15:35:27 +02:00
parent 4e914e5d3a
commit 9891cc48ac

View file

@ -260,11 +260,11 @@ impl From<&BareJid> for String {
} }
} }
impl Into<BareJid> for FullJid { impl From<FullJid> for BareJid {
fn into(self) -> BareJid { fn from(full: FullJid) -> BareJid {
BareJid { BareJid {
node: self.node, node: full.node,
domain: self.domain, domain: full.domain,
} }
} }
} }
@ -333,7 +333,7 @@ fn _from_str(s: &str) -> Result<StringJid, JidParseError> {
ParserState::Node => { ParserState::Node => {
match c { match c {
'@' => { '@' => {
if buf == "" { if buf.is_empty() {
return Err(JidParseError::EmptyNode); return Err(JidParseError::EmptyNode);
} }
state = ParserState::Domain; state = ParserState::Domain;
@ -341,7 +341,7 @@ fn _from_str(s: &str) -> Result<StringJid, JidParseError> {
buf.clear(); buf.clear();
} }
'/' => { '/' => {
if buf == "" { if buf.is_empty() {
return Err(JidParseError::NoDomain); return Err(JidParseError::NoDomain);
} }
state = ParserState::Resource; state = ParserState::Resource;
@ -356,7 +356,7 @@ fn _from_str(s: &str) -> Result<StringJid, JidParseError> {
ParserState::Domain => { ParserState::Domain => {
match c { match c {
'/' => { '/' => {
if buf == "" { if buf.is_empty() {
return Err(JidParseError::NoDomain); return Err(JidParseError::NoDomain);
} }
state = ParserState::Resource; state = ParserState::Resource;
@ -683,9 +683,9 @@ impl IntoAttributeValue for Jid {
} }
#[cfg(feature = "minidom")] #[cfg(feature = "minidom")]
impl Into<Node> for Jid { impl From<Jid> for Node {
fn into(self) -> Node { fn from(jid: Jid) -> Node {
Node::Text(String::from(self)) Node::Text(String::from(jid))
} }
} }
@ -697,9 +697,9 @@ impl IntoAttributeValue for FullJid {
} }
#[cfg(feature = "minidom")] #[cfg(feature = "minidom")]
impl Into<Node> for FullJid { impl From<FullJid> for Node {
fn into(self) -> Node { fn from(jid: FullJid) -> Node {
Node::Text(String::from(self)) Node::Text(String::from(jid))
} }
} }
@ -711,9 +711,9 @@ impl IntoAttributeValue for BareJid {
} }
#[cfg(feature = "minidom")] #[cfg(feature = "minidom")]
impl Into<Node> for BareJid { impl From<BareJid> for Node {
fn into(self) -> Node { fn from(jid: BareJid) -> Node {
Node::Text(String::from(self)) Node::Text(String::from(jid))
} }
} }