diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-12 16:14:32 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-24 18:43:37 +1100 |
| commit | 9dd5340d3cbbd3acbe6cc9dfcbcea07e7eb4355e (patch) | |
| tree | 5794f00500d66ab6312a9e1a28ba54e8649b0c0d /src/tools/rustfmt | |
| parent | aa8f0fd7163a2f23aa958faed30c9c2b77b934a5 (diff) | |
| download | rust-9dd5340d3cbbd3acbe6cc9dfcbcea07e7eb4355e.tar.gz rust-9dd5340d3cbbd3acbe6cc9dfcbcea07e7eb4355e.zip | |
Remove `is_any_keyword` methods.
They're dodgy, covering all the keywords, including weak ones, and edition-specific ones without considering the edition. They have a single use in rustfmt. This commit changes that use to `is_reserved_ident`, which is a much more widely used alternative and is good enough, judging by the lack of effect on the test suite.
Diffstat (limited to 'src/tools/rustfmt')
| -rw-r--r-- | src/tools/rustfmt/src/parse/macros/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/rustfmt/src/parse/macros/mod.rs b/src/tools/rustfmt/src/parse/macros/mod.rs index 680a35f7e03..d7964484b26 100644 --- a/src/tools/rustfmt/src/parse/macros/mod.rs +++ b/src/tools/rustfmt/src/parse/macros/mod.rs @@ -81,7 +81,7 @@ pub(crate) struct ParsedMacroArgs { } fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> { - if parser.token.is_any_keyword() + if parser.token.is_reserved_ident() && parser.look_ahead(1, |t| *t == TokenKind::Eof || *t == TokenKind::Comma) { let keyword = parser.token.ident().unwrap().0.name; |
