Fix some clippy warnings
This commit is contained in:
parent
05a0b6cd8f
commit
12d102b39c
3 changed files with 9 additions and 9 deletions
|
@ -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..]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue