xso: clippy run
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
2555bedaa8
commit
5b62672541
4 changed files with 10 additions and 10 deletions
|
|
@ -104,7 +104,7 @@ where
|
||||||
/// Provides a helper which implements Display printing raw XML
|
/// Provides a helper which implements Display printing raw XML
|
||||||
pub struct PrintRawXml<'x, T>(pub &'x T);
|
pub struct PrintRawXml<'x, T>(pub &'x T);
|
||||||
|
|
||||||
impl<'x, T: AsXml> fmt::Display for PrintRawXml<'x, T> {
|
impl<T: AsXml> fmt::Display for PrintRawXml<'_, T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let iter = match self.0.as_xml_iter() {
|
let iter = match self.0.as_xml_iter() {
|
||||||
Ok(iter) => iter,
|
Ok(iter) => iter,
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ pub struct Empty {
|
||||||
#[cfg(feature = "macros")]
|
#[cfg(feature = "macros")]
|
||||||
impl Empty {
|
impl Empty {
|
||||||
pub fn start(self, attr: rxml::AttrMap) -> Result<EmptyBuilder, Error> {
|
pub fn start(self, attr: rxml::AttrMap) -> Result<EmptyBuilder, Error> {
|
||||||
if attr.len() > 0 {
|
if !attr.is_empty() {
|
||||||
return Err(Error::Other(self.attributeerr));
|
return Err(Error::Other(self.attributeerr));
|
||||||
}
|
}
|
||||||
Ok(EmptyBuilder {
|
Ok(EmptyBuilder {
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ impl<'a> Iterator for ElementAsXml<'a> {
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
None => None,
|
None => None,
|
||||||
Some(AsXmlState::Header { ref element }) => {
|
Some(AsXmlState::Header { element }) => {
|
||||||
let item = Item::ElementHeadStart(
|
let item = Item::ElementHeadStart(
|
||||||
Namespace::from(element.ns()),
|
Namespace::from(element.ns()),
|
||||||
Cow::Borrowed(match <&NcNameStr>::try_from(element.name()) {
|
Cow::Borrowed(match <&NcNameStr>::try_from(element.name()) {
|
||||||
|
|
@ -214,7 +214,7 @@ impl<'a> Iterator for ElementAsXml<'a> {
|
||||||
}
|
}
|
||||||
Some(AsXmlState::Attributes {
|
Some(AsXmlState::Attributes {
|
||||||
ref mut attributes,
|
ref mut attributes,
|
||||||
ref element,
|
element,
|
||||||
}) => {
|
}) => {
|
||||||
if let Some((name, value)) = attributes.next() {
|
if let Some((name, value)) = attributes.next() {
|
||||||
let name = match <&NameStr>::try_from(name) {
|
let name = match <&NameStr>::try_from(name) {
|
||||||
|
|
@ -282,7 +282,7 @@ impl<'a> Iterator for ElementAsXml<'a> {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.0 = None;
|
self.0 = None;
|
||||||
return Some(Err(e.into()));
|
return Some(Err(e));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let item = iter.next().unwrap();
|
let item = iter.next().unwrap();
|
||||||
|
|
@ -445,7 +445,7 @@ pub struct AsItemsViaElement<'x> {
|
||||||
lifetime_binding: PhantomData<Item<'x>>,
|
lifetime_binding: PhantomData<Item<'x>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'x> AsItemsViaElement<'x> {
|
impl AsItemsViaElement<'_> {
|
||||||
/// Create a new streaming parser for `T`.
|
/// Create a new streaming parser for `T`.
|
||||||
pub fn new<E, T>(value: T) -> Result<Self, crate::error::Error>
|
pub fn new<E, T>(value: T) -> Result<Self, crate::error::Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ impl TextCodec<Vec<u8>> for Base64 {
|
||||||
fn encode<'x>(&self, value: &'x Vec<u8>) -> Result<Option<Cow<'x, str>>, Error> {
|
fn encode<'x>(&self, value: &'x Vec<u8>) -> Result<Option<Cow<'x, str>>, Error> {
|
||||||
Ok(Some(Cow::Owned(base64::engine::Engine::encode(
|
Ok(Some(Cow::Owned(base64::engine::Engine::encode(
|
||||||
&StandardBase64Engine,
|
&StandardBase64Engine,
|
||||||
&value,
|
value,
|
||||||
))))
|
))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -328,7 +328,7 @@ impl<'x> TextCodec<Cow<'x, [u8]>> for Base64 {
|
||||||
fn encode<'a>(&self, value: &'a Cow<'x, [u8]>) -> Result<Option<Cow<'a, str>>, Error> {
|
fn encode<'a>(&self, value: &'a Cow<'x, [u8]>) -> Result<Option<Cow<'a, str>>, Error> {
|
||||||
Ok(Some(Cow::Owned(base64::engine::Engine::encode(
|
Ok(Some(Cow::Owned(base64::engine::Engine::encode(
|
||||||
&StandardBase64Engine,
|
&StandardBase64Engine,
|
||||||
&value,
|
value,
|
||||||
))))
|
))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -362,13 +362,13 @@ impl<T: base64::engine::Engine> TextCodec<Vec<u8>> for T {
|
||||||
|
|
||||||
fn encode<'x>(&self, value: &'x Vec<u8>) -> Result<Option<Cow<'x, str>>, Error> {
|
fn encode<'x>(&self, value: &'x Vec<u8>) -> Result<Option<Cow<'x, str>>, Error> {
|
||||||
Ok(Some(Cow::Owned(base64::engine::Engine::encode(
|
Ok(Some(Cow::Owned(base64::engine::Engine::encode(
|
||||||
self, &value,
|
self, value,
|
||||||
))))
|
))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "base64")]
|
#[cfg(feature = "base64")]
|
||||||
impl<'a, T: base64::engine::Engine, U> TextCodec<Option<U>> for T
|
impl<T: base64::engine::Engine, U> TextCodec<Option<U>> for T
|
||||||
where
|
where
|
||||||
T: TextCodec<U>,
|
T: TextCodec<U>,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue