From b5fbb9c2175a3e46df713b127a35d30bc17c712a Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 4 Mar 2021 12:08:55 -0800 Subject: [PATCH] cargo clippy --- parser/src/context.rs | 6 +++--- parser/src/test.rs | 4 ++-- parser/src/tokenizer.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/parser/src/context.rs b/parser/src/context.rs index b213755c02..355fbe4737 100644 --- a/parser/src/context.rs +++ b/parser/src/context.rs @@ -60,13 +60,13 @@ impl ParserContext { pub fn peek_oneof(&self, token: &[Token]) -> SyntaxResult<&SpannedToken> { if let Some(spanned_token) = self.inner.last() { if token.iter().any(|x| x == &spanned_token.token) { - return Ok(spanned_token); + Ok(spanned_token) } else { - return Err(SyntaxError::unexpected( + Err(SyntaxError::unexpected( &spanned_token.token, token, &spanned_token.span, - )); + )) } } else { Err(self.eof()) diff --git a/parser/src/test.rs b/parser/src/test.rs index dc1f0888b9..1014d83e85 100644 --- a/parser/src/test.rs +++ b/parser/src/test.rs @@ -53,7 +53,7 @@ pub fn parser_pass_tests() { } } } - if fail.len() > 0 { + if !fail.is_empty() { for (i, fail) in fail.iter().enumerate() { println!( "\n\n-----------------TEST #{} FAILED (and shouldn't have)-----------------", @@ -84,7 +84,7 @@ pub fn parser_fail_tests() { } } } - if fail.len() > 0 { + if !fail.is_empty() { for (i, fail) in fail.iter().enumerate() { println!( "\n\n-----------------TEST #{} PASSED (and shouldn't have)-----------------", diff --git a/parser/src/tokenizer.rs b/parser/src/tokenizer.rs index b7eb61deba..2285227d5c 100644 --- a/parser/src/tokenizer.rs +++ b/parser/src/tokenizer.rs @@ -79,7 +79,7 @@ impl Token { } fn gobble(input: &[u8]) -> (&[u8], Option) { - if input.len() == 0 { + if input.is_empty() { return (input, None); } match input[0] {