diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-08-10 20:11:22 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-08-17 09:04:54 +1000 |
| commit | acd3a5e35f48d7afa19ce2f56a473c2b7888908d (patch) | |
| tree | 4caf09c129667624c36677a672b3c81b4f488869 /compiler/rustc_parse/src | |
| parent | 4ab3e9d5b9b1f4163cc5d3208c0c3f7f99f3b2f6 (diff) | |
| download | rust-acd3a5e35f48d7afa19ce2f56a473c2b7888908d.tar.gz rust-acd3a5e35f48d7afa19ce2f56a473c2b7888908d.zip | |
Remove unnecessary braces on `PatWithOr` patterns.
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/nonterminal.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index 7fb517ffdb8..2bf670c24ea 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -64,7 +64,7 @@ impl<'a> Parser<'a> { }, _ => false, }, - NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => { + NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr => { match &token.kind { token::Ident(..) | // box, ref, mut, and other identifiers (can stricten) token::OpenDelim(Delimiter::Parenthesis) | // tuple pattern @@ -79,7 +79,7 @@ impl<'a> Parser<'a> { token::Lt | // path (UFCS constant) token::BinOp(token::Shl) => true, // path (double UFCS) // leading vert `|` or-pattern - token::BinOp(token::Or) => matches!(kind, NonterminalKind::PatWithOr {..}), + token::BinOp(token::Or) => matches!(kind, NonterminalKind::PatWithOr), token::Interpolated(nt) => may_be_ident(nt), _ => false, } @@ -127,10 +127,10 @@ impl<'a> Parser<'a> { .into_diagnostic(&self.sess.span_diagnostic)); } }, - NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => { + NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr => { token::NtPat(self.collect_tokens_no_attrs(|this| match kind { NonterminalKind::PatParam { .. } => this.parse_pat_no_top_alt(None, None), - NonterminalKind::PatWithOr { .. } => this.parse_pat_allow_top_alt( + NonterminalKind::PatWithOr => this.parse_pat_allow_top_alt( None, RecoverComma::No, RecoverColon::No, |
