xso: Fix all failing clippy tests

They are all sensible to me.

skip-changelog: Internal changes.
This commit is contained in:
Emmanuel Gil Peyrot 2025-02-12 18:53:29 +01:00 committed by Link Mauve
commit 356ad0d46e
5 changed files with 10 additions and 11 deletions

View file

@ -280,14 +280,14 @@ pub trait AsXmlText {
impl AsXmlText for String {
/// Return the borrowed string contents.
fn as_xml_text(&self) -> Result<Cow<'_, str>, self::error::Error> {
Ok(Cow::Borrowed(self.as_str()))
Ok(Cow::Borrowed(self))
}
}
impl AsXmlText for str {
/// Return the borrowed string contents.
fn as_xml_text(&self) -> Result<Cow<'_, str>, self::error::Error> {
Ok(Cow::Borrowed(&*self))
Ok(Cow::Borrowed(self))
}
}
@ -301,7 +301,7 @@ impl<T: AsXmlText> AsXmlText for Box<T> {
impl<B: AsXmlText + ToOwned> AsXmlText for Cow<'_, B> {
/// Return the borrowed [`Cow`] contents.
fn as_xml_text(&self) -> Result<Cow<'_, str>, self::error::Error> {
B::as_xml_text(self.as_ref())
B::as_xml_text(self)
}
}