From 366d3d75449851c7a10e9432bcdbe89515f8d49b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 17 Sep 2021 23:27:26 +0300 Subject: [PATCH 1/2] minor: cleanup --- crates/parser/src/grammar.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index 7243b89583..bca1b7b2aa 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -166,7 +166,7 @@ fn opt_visibility(p: &mut Parser) -> bool { // struct B(pub (super::A)); // struct B(pub (crate::A,)); T![crate] | T![self] | T![super] | T![ident] if p.nth(2) != T![:] => { - p.bump_any(); + p.bump(T!['(']); let path_m = p.start(); let path_segment_m = p.start(); let name_ref_m = p.start(); @@ -180,8 +180,8 @@ fn opt_visibility(p: &mut Parser) -> bool { // pub(in super::A) struct S; // pub(in crate) struct S; T![in] => { - p.bump_any(); - p.bump_any(); + p.bump(T!['(']); + p.bump(T![in]); paths::use_path(p); p.expect(T![')']); } From 4d2956e7751182a14dcc5f45ebc351a3e71118c7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 17 Sep 2021 23:31:37 +0300 Subject: [PATCH 2/2] minor: simplify --- crates/parser/src/grammar.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index bca1b7b2aa..23f0cc0153 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -167,13 +167,7 @@ fn opt_visibility(p: &mut Parser) -> bool { // struct B(pub (crate::A,)); T![crate] | T![self] | T![super] | T![ident] if p.nth(2) != T![:] => { p.bump(T!['(']); - let path_m = p.start(); - let path_segment_m = p.start(); - let name_ref_m = p.start(); - p.bump_any(); - name_ref_m.complete(p, NAME_REF); - path_segment_m.complete(p, PATH_SEGMENT); - path_m.complete(p, PATH); + paths::use_path(p); p.expect(T![')']); } // test crate_visibility_in