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:
parent
75e0cb7dc3
commit
a8c66bc783
3 changed files with 7 additions and 7 deletions
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue