about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-08 13:23:31 +0000
committerbors <bors@rust-lang.org>2024-03-08 13:23:31 +0000
commit2397e7a887252aa995d3790164b34b6c76ed94b4 (patch)
tree159e4d14f57a3bb88e5c11b434b7c938af721d01
parent2b7b44bf27a7635eded9aa53678acb2c4e25063e (diff)
parenta838e44032d3b6dfe3314f763034e033b59477ad (diff)
downloadrust-2397e7a887252aa995d3790164b34b6c76ed94b4.tar.gz
rust-2397e7a887252aa995d3790164b34b6c76ed94b4.zip
Auto merge of #16787 - pksunkara:remove-macro-call-check, r=lnicola
Remove unncessary check for macro call

Since `macro_rules` is a contextual keyword, it is an `IDENT` token and thus `is_path_start` already identifies it correctly. You can tell the previous check is unnecessary because the relevant tests still pass.
-rw-r--r--crates/parser/src/grammar/items.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index ee11571307c..25c00ccf5f3 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -70,8 +70,7 @@ pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool) {
     // macro_rules! {};
     // macro_rules! ()
     // macro_rules! []
-    let no_ident = p.at_contextual_kw(T![macro_rules]) && p.nth_at(1, BANG) && !p.nth_at(2, IDENT);
-    if paths::is_use_path_start(p) || no_ident {
+    if paths::is_use_path_start(p) {
         macro_call(p, m);
         return;
     }