From c401b519cb6d497e6e4920551d6b480542319358 Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 19 Dec 2023 06:23:21 +0100 Subject: [PATCH] Fix clippy warnings --- atat_derive/src/helpers.rs | 2 +- serde_at/src/de/mod.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/atat_derive/src/helpers.rs b/atat_derive/src/helpers.rs index cc018462..b5217608 100644 --- a/atat_derive/src/helpers.rs +++ b/atat_derive/src/helpers.rs @@ -52,7 +52,7 @@ pub fn add_type_parameter_bound( let where_type = syn::PredicateType { bounded_ty: parse_quote!(#ident), colon_token: ::default(), - bounds: vec![trait_bound].iter().cloned().collect(), + bounds: [trait_bound].iter().cloned().collect(), lifetimes: None, }; generics diff --git a/serde_at/src/de/mod.rs b/serde_at/src/de/mod.rs index 82d21ae6..0658bf38 100644 --- a/serde_at/src/de/mod.rs +++ b/serde_at/src/de/mod.rs @@ -176,16 +176,14 @@ impl<'a> Deserializer<'a> { if self.is_trailing_parsing { self.index = self.slice.len(); return Ok(&self.slice[start..]); - } else { - if let Some(c) = self.peek() { - if (c as char).is_alphanumeric() || (c as char).is_whitespace() { - self.eat_char(); - } else { - return Err(Error::EofWhileParsingString); - } + } else if let Some(c) = self.peek() { + if (c as char).is_alphanumeric() || (c as char).is_whitespace() { + self.eat_char(); } else { - return Ok(&self.slice[start..self.index]); + return Err(Error::EofWhileParsingString); } + } else { + return Ok(&self.slice[start..self.index]); } } }