Change summary
minidom/src/element.rs | 2 +-
tokio-xmpp/src/xmlstream/initiator.rs | 6 +++---
tokio-xmpp/src/xmlstream/responder.rs | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
Detailed changes
@@ -399,7 +399,7 @@ impl Element {
pub fn write_to_inner<W: io::Write>(&self, writer: &mut ItemWriter<W>) -> Result<()> {
for (prefix, namespace) in self.prefixes.declared_prefixes() {
assert!(writer.encoder.ns_tracker_mut().declare_fixed(
- prefix.as_ref().map(|x| (&**x).try_into()).transpose()?,
+ prefix.as_deref().map(TryInto::try_into).transpose()?,
namespace.clone().into(),
));
}
@@ -55,9 +55,9 @@ impl<Io> PendingFeaturesRecv<Io> {
/// The stream header contents as sent by the peer.
pub fn header(&self) -> StreamHeader<'_> {
StreamHeader {
- from: self.header.from.as_ref().map(|x| Cow::Borrowed(&**x)),
- to: self.header.to.as_ref().map(|x| Cow::Borrowed(&**x)),
- id: self.header.id.as_ref().map(|x| Cow::Borrowed(&**x)),
+ from: self.header.from.as_deref().map(Cow::Borrowed),
+ to: self.header.to.as_deref().map(Cow::Borrowed),
+ id: self.header.id.as_deref().map(Cow::Borrowed),
}
}
@@ -33,9 +33,9 @@ impl<Io> AcceptedStream<Io> {
/// The stream header contents as sent by the peer.
pub fn header(&self) -> StreamHeader<'_> {
StreamHeader {
- from: self.header.from.as_ref().map(|x| Cow::Borrowed(&**x)),
- to: self.header.to.as_ref().map(|x| Cow::Borrowed(&**x)),
- id: self.header.id.as_ref().map(|x| Cow::Borrowed(&**x)),
+ from: self.header.from.as_deref().map(Cow::Borrowed),
+ to: self.header.to.as_deref().map(Cow::Borrowed),
+ id: self.header.id.as_deref().map(Cow::Borrowed),
}
}