From 3cd8e9866d55ddd962e6bda92018cbf4bc9ee08f Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 11 May 2022 10:14:49 +1000 Subject: [PATCH] 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. --- compiler/rustc_parse/src/parser/diagnostics.rs | 3 +-- src/tools/rustfmt/src/parse/macros/mod.rs | 4 +--- 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 @@ pub(super) fn consume_block(&mut self, delim: Delimiter, consume_close: ConsumeC 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 { 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();