Fix some clippy warnings

Aurabindo Pillai created

Change summary

jid/src/inner.rs       | 8 ++++----
jid/src/lib.rs         | 8 ++++----
xmpp/src/pubsub/mod.rs | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)

Detailed changes

jid/src/inner.rs 🔗

@@ -108,9 +108,9 @@ impl InnerJid {
     }
 
     pub(crate) fn node(&self) -> Option<&str> {
-        self.at.and_then(|at| {
+        self.at.map(|at| {
             let at = u16::from(at) as usize;
-            Some(&self.normalized[..at])
+            &self.normalized[..at]
         })
     }
 
@@ -134,9 +134,9 @@ impl InnerJid {
     }
 
     pub(crate) fn resource(&self) -> Option<&str> {
-        self.slash.and_then(|slash| {
+        self.slash.map(|slash| {
             let slash = u16::from(slash) as usize;
-            Some(&self.normalized[slash + 1..])
+            &self.normalized[slash + 1..]
         })
     }
 }

jid/src/lib.rs 🔗

@@ -148,7 +148,7 @@ impl Jid {
     pub fn node(&self) -> Option<NodePart> {
         match self {
             Jid::Bare(BareJid { inner }) | Jid::Full(FullJid { inner }) => {
-                inner.node().map(|s| NodePart::new_unchecked(s))
+                inner.node().map(NodePart::new_unchecked)
             }
         }
     }
@@ -181,7 +181,7 @@ impl Jid {
     pub fn resource(&self) -> Option<ResourcePart> {
         match self {
             Jid::Bare(BareJid { inner }) | Jid::Full(FullJid { inner }) => {
-                inner.resource().map(|s| ResourcePart::new_unchecked(s))
+                inner.resource().map(ResourcePart::new_unchecked)
             }
         }
     }
@@ -470,7 +470,7 @@ impl FullJid {
 
     /// The optional node part of the JID, as a [`NodePart`]
     pub fn node(&self) -> Option<NodePart> {
-        self.node_str().map(|s| NodePart::new_unchecked(s))
+        self.node_str().map(NodePart::new_unchecked)
     }
 
     /// The optional node part of the JID, as a stringy reference
@@ -587,7 +587,7 @@ impl BareJid {
 
     /// The optional node part of the JID, as a [`NodePart`]
     pub fn node(&self) -> Option<NodePart> {
-        self.node_str().map(|s| NodePart::new_unchecked(s))
+        self.node_str().map(NodePart::new_unchecked)
     }
 
     /// The optional node part of the JID, as a stringy reference

xmpp/src/pubsub/mod.rs 🔗

@@ -72,7 +72,7 @@ pub(crate) async fn handle_event(from: &Jid, elem: Element, agent: &mut Agent) -
                 }
                 ref node => unimplemented!("node {}", node),
             }
-        },
+        }
         Err(e) => {
             error!("Error parsing PubSub event: {}", e);
         }