about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-05-11 10:14:49 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-05-11 10:14:49 +1000
commit3cd8e9866d55ddd962e6bda92018cbf4bc9ee08f (patch)
tree02ed159e81f5e7b78038d0c57b26149b9f5a0501
parentbb398ca59447d8be1d9a9386de0f8ba2ecc3d9c1 (diff)
downloadrust-3cd8e9866d55ddd962e6bda92018cbf4bc9ee08f.tar.gz
rust-3cd8e9866d55ddd962e6bda92018cbf4bc9ee08f.zip
Remove some unnecessary invisible delimiter checks.
These seem to have no useful effect... they don't seem useful from a
code inspection point of view, and they affect anything in the test
suite.
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs3
-rw-r--r--src/tools/rustfmt/src/parse/macros/mod.rs4
2 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index beffbdc5de4..369650edd57 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -2109,8 +2109,7 @@ impl<'a> Parser<'a> {
                     brace_depth -= 1;
                     continue;
                 }
-            } else if self.token == token::Eof || self.eat(&token::CloseDelim(Delimiter::Invisible))
-            {
+            } else if self.token == token::Eof {
                 return;
             } else {
                 self.bump();
diff --git a/src/tools/rustfmt/src/parse/macros/mod.rs b/src/tools/rustfmt/src/parse/macros/mod.rs
index d4dbf21f8ca..67f3985926e 100644
--- a/src/tools/rustfmt/src/parse/macros/mod.rs
+++ b/src/tools/rustfmt/src/parse/macros/mod.rs
@@ -79,9 +79,7 @@ fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
     for &keyword in RUST_KW.iter() {
         if parser.token.is_keyword(keyword)
             && parser.look_ahead(1, |t| {
-                t.kind == TokenKind::Eof
-                    || t.kind == TokenKind::Comma
-                    || t.kind == TokenKind::CloseDelim(Delimiter::Invisible)
+                t.kind == TokenKind::Eof || t.kind == TokenKind::Comma
             })
         {
             parser.bump();