diff options
| author | Marek Barvíř <barvirm@gmail.com> | 2023-03-28 09:38:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-28 09:38:01 +0200 |
| commit | 213f31c5d71b3a5676ec8cce58204b1ac7f2cdea (patch) | |
| tree | bb0730bbc768f80eb3995b3a55d12a0f62ab3ee8 /src/syntax | |
| parent | dfbd3503d9a03215238ade30726651b09d6fab2d (diff) | |
Fix basic lints (cargo clippy) (#383)
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/lexer.rs | 6 | ||||
| -rw-r--r-- | src/syntax/reparser.rs | 4 | ||||
| -rw-r--r-- | src/syntax/source.rs | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/syntax/lexer.rs b/src/syntax/lexer.rs index 43a4872b..a5e4a9e0 100644 --- a/src/syntax/lexer.rs +++ b/src/syntax/lexer.rs @@ -284,10 +284,8 @@ impl Lexer<'_> { self.s.eat_while(char::is_ascii_digit); let read = self.s.from(start); - if self.s.eat_if('.') && self.space_or_end() { - if read.parse::<usize>().is_ok() { - return SyntaxKind::EnumMarker; - } + if self.s.eat_if('.') && self.space_or_end() && read.parse::<usize>().is_ok() { + return SyntaxKind::EnumMarker; } self.text() diff --git a/src/syntax/reparser.rs b/src/syntax/reparser.rs index 75a5cc27..18960941 100644 --- a/src/syntax/reparser.rs +++ b/src/syntax/reparser.rs @@ -72,7 +72,7 @@ fn try_reparse( return node .replace_children(i..i + 1, vec![newborn]) .is_ok() - .then(|| new_range); + .then_some(new_range); } } } @@ -157,7 +157,7 @@ fn try_reparse( return node .replace_children(start..end, newborns) .is_ok() - .then(|| new_range); + .then_some(new_range); } } } diff --git a/src/syntax/source.rs b/src/syntax/source.rs index e8553b1e..233fb367 100644 --- a/src/syntax/source.rs +++ b/src/syntax/source.rs @@ -212,7 +212,7 @@ impl Source { k += c.len_utf16(); } - (k == utf16_idx).then(|| self.text.len()) + (k == utf16_idx).then_some(self.text.len()) } /// Return the byte position at which the given line starts. |
