minidom, tokio-xmpp: Use Option::as_deref()

This simplifies the Option::as_ref().map(|foo| &**foo) pattern a lot.

skip-changelog: Completely internal change.
This commit is contained in:
Link Mauve 2025-04-18 23:58:07 +02:00
commit a8c66bc783
3 changed files with 7 additions and 7 deletions

View file

@ -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),
}
}

View file

@ -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),
}
}