Skip to content

Commit acd3a5e

Browse files
committed
Remove unnecessary braces on PatWithOr patterns.
1 parent 4ab3e9d commit acd3a5e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
13281328
_ => IsInFollow::No(TOKENS),
13291329
}
13301330
}
1331-
NonterminalKind::PatWithOr { .. } => {
1331+
NonterminalKind::PatWithOr => {
13321332
const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`if`", "`in`"];
13331333
match tok {
13341334
TokenTree::Token(token) => match token.kind {

compiler/rustc_parse/src/parser/nonterminal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'a> Parser<'a> {
6464
},
6565
_ => false,
6666
},
67-
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => {
67+
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr => {
6868
match &token.kind {
6969
token::Ident(..) | // box, ref, mut, and other identifiers (can stricten)
7070
token::OpenDelim(Delimiter::Parenthesis) | // tuple pattern
@@ -79,7 +79,7 @@ impl<'a> Parser<'a> {
7979
token::Lt | // path (UFCS constant)
8080
token::BinOp(token::Shl) => true, // path (double UFCS)
8181
// leading vert `|` or-pattern
82-
token::BinOp(token::Or) => matches!(kind, NonterminalKind::PatWithOr {..}),
82+
token::BinOp(token::Or) => matches!(kind, NonterminalKind::PatWithOr),
8383
token::Interpolated(nt) => may_be_ident(nt),
8484
_ => false,
8585
}
@@ -127,10 +127,10 @@ impl<'a> Parser<'a> {
127127
.into_diagnostic(&self.sess.span_diagnostic));
128128
}
129129
},
130-
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => {
130+
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr => {
131131
token::NtPat(self.collect_tokens_no_attrs(|this| match kind {
132132
NonterminalKind::PatParam { .. } => this.parse_pat_no_top_alt(None, None),
133-
NonterminalKind::PatWithOr { .. } => this.parse_pat_allow_top_alt(
133+
NonterminalKind::PatWithOr => this.parse_pat_allow_top_alt(
134134
None,
135135
RecoverComma::No,
136136
RecoverColon::No,

0 commit comments

Comments
 (0)