Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar.rs')
-rw-r--r--crates/parser/src/grammar.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs
index e8a9ddde69..0623e7ea19 100644
--- a/crates/parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
@@ -250,7 +250,8 @@ fn opt_visibility_inner(p: &mut Parser<'_>, in_tuple_field: bool) -> bool {
// test pub_parens_typepath
// struct B(pub (super::A));
// struct B(pub (crate::A,));
- T![crate] | T![self] | T![super] | T![ident] | T![')'] if p.nth(2) != T![:] => {
+ T![crate] | T![self] | T![super] | T![ident] | T![')']
+ if p.nth(2) != T![:]
// If we are in a tuple struct, then the parens following `pub`
// might be an tuple field, not part of the visibility. So in that
// case we don't want to consume an identifier.
@@ -259,14 +260,14 @@ fn opt_visibility_inner(p: &mut Parser<'_>, in_tuple_field: bool) -> bool {
// struct MyStruct(pub (u32, u32));
// struct MyStruct(pub (u32));
// struct MyStruct(pub ());
- if !(in_tuple_field && matches!(p.nth(1), T![ident] | T![')'])) {
- let m = p.start();
- p.bump(T!['(']);
- paths::vis_path(p);
- p.expect(T![')']);
- m.complete(p, VISIBILITY_INNER);
- return true;
- }
+ && !(in_tuple_field && matches!(p.nth(1), T![ident] | T![')'])) =>
+ {
+ let m = p.start();
+ p.bump(T!['(']);
+ paths::vis_path(p);
+ p.expect(T![')']);
+ m.complete(p, VISIBILITY_INNER);
+ return true;
}
// test crate_visibility_in
// pub(in super::A) struct S;