diff options
| author | shogo-nakano-desu <61229807+shogo-nakano-desu@users.noreply.github.com> | 2023-09-15 16:43:21 +0900 |
|---|---|---|
| committer | shogo-nakano-desu <61229807+shogo-nakano-desu@users.noreply.github.com> | 2023-09-15 16:43:21 +0900 |
| commit | ebbbaaa90f4dd111b1bb9df7250925f612110925 (patch) | |
| tree | d0e0bd670350d56a2138eb08b2d54f36bc7ab1ba /crates/parser | |
| parent | 12e28c35758051dd6bc9cdf419a50dff80fab64d (diff) | |
| download | rust-ebbbaaa90f4dd111b1bb9df7250925f612110925.tar.gz rust-ebbbaaa90f4dd111b1bb9df7250925f612110925.zip | |
refactor: fix clippy lints
Diffstat (limited to 'crates/parser')
| -rw-r--r-- | crates/parser/src/shortcuts.rs | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/crates/parser/src/shortcuts.rs b/crates/parser/src/shortcuts.rs index 2c47e3d086d..57005a6834c 100644 --- a/crates/parser/src/shortcuts.rs +++ b/crates/parser/src/shortcuts.rs @@ -32,29 +32,27 @@ impl LexedStr<'_> { let kind = self.kind(i); if kind.is_trivia() { was_joint = false + } else if kind == SyntaxKind::IDENT { + let token_text = self.text(i); + let contextual_kw = + SyntaxKind::from_contextual_keyword(token_text).unwrap_or(SyntaxKind::IDENT); + res.push_ident(contextual_kw); } else { - if kind == SyntaxKind::IDENT { - let token_text = self.text(i); - let contextual_kw = SyntaxKind::from_contextual_keyword(token_text) - .unwrap_or(SyntaxKind::IDENT); - res.push_ident(contextual_kw); - } else { - if was_joint { + if was_joint { + res.was_joint(); + } + res.push(kind); + // Tag the token as joint if it is float with a fractional part + // we use this jointness to inform the parser about what token split + // event to emit when we encounter a float literal in a field access + if kind == SyntaxKind::FLOAT_NUMBER { + if !self.text(i).ends_with('.') { res.was_joint(); - } - res.push(kind); - // Tag the token as joint if it is float with a fractional part - // we use this jointness to inform the parser about what token split - // event to emit when we encounter a float literal in a field access - if kind == SyntaxKind::FLOAT_NUMBER { - if !self.text(i).ends_with('.') { - res.was_joint(); - } else { - was_joint = false; - } } else { - was_joint = true; + was_joint = false; } + } else { + was_joint = true; } } } |
