From c52169f535f89c0300ec06e13ddcaa7e0f459a0b Mon Sep 17 00:00:00 2001 From: Jonas Maier Date: Mon, 1 Jun 2026 21:17:23 +0200 Subject: clippy --- src/parse/mod.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/parse/mod.rs') diff --git a/src/parse/mod.rs b/src/parse/mod.rs index e7a2d1d..b3855a8 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -1382,11 +1382,11 @@ impl HighlightKind { /// all highlight kind variants *except* None pub fn variants() -> impl Iterator { let a = Keyword::VARIANTS - .into_iter() + .iter() .cloned() .map(HighlightKind::Keyword); let b = OtherHighlights::VARIANTS - .into_iter() + .iter() .cloned() .map(HighlightKind::Other); a.chain(b) @@ -1405,7 +1405,7 @@ impl HighlightKind { match ident { b"keywords" => { return Keyword::VARIANTS - .into_iter() + .iter() .cloned() .map(HighlightKind::Keyword) .collect(); @@ -1421,15 +1421,14 @@ impl HighlightKind { } Self::variants() - .into_iter() .filter(|x| x.identifier() == ident) .collect() } pub fn all_identifiers() -> Vec { - let kw = Keyword::VARIANTS.into_iter().map(Keyword::identifier); + let kw = Keyword::VARIANTS.iter().map(Keyword::identifier); let ot = OtherHighlights::VARIANTS - .into_iter() + .iter() .map(OtherHighlights::identifier); let groups = [&b"keywords"[..], b"braces", b"all", b"everything"]; kw.chain(ot) @@ -1650,13 +1649,11 @@ impl<'a> Cursor<'a> { self.buf = &self.buf[bytes.len() + 1..]; self.spaces(); Ok(()) + } else if self.is_completion() && self.buf.len() == bytes.len() { + self.buf = &self.buf[bytes.len()..]; + Ok(()) } else { - if self.is_completion() && self.buf.len() == bytes.len() { - self.buf = &self.buf[bytes.len()..]; - Ok(()) - } else { - Err(ParseError::ExpectedKeyword(kw)) - } + Err(ParseError::ExpectedKeyword(kw)) } } else { self.buf = &self.buf[bytes.len()..]; @@ -1931,7 +1928,7 @@ impl Parse for Case { let mut branches = Vec::new(); loop { b.spaces(); - if let Ok(_) = b.consume_keyword(Keyword::CloseBrace) { + if b.consume_keyword(Keyword::CloseBrace).is_ok() { break; } branches.push(CaseBranch::parse(b)?); -- cgit v1.2.3