Skip to content

Commit

Permalink
revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Oct 13, 2023
1 parent 33d9f1e commit bb992a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ impl Token {
Literal(..) | BinOp(Minus) => true,
Ident(name, false) if name.is_bool_lit() => true,
Interpolated(ref nt) => match &nt.0 {
NtLiteral(..) => true,
NtLiteral(_) => true,
NtExpr(e) => match &e.kind {
ast::ExprKind::Lit(_) => true,
ast::ExprKind::Unary(ast::UnOp::Neg, e) => {
Expand Down Expand Up @@ -628,7 +628,7 @@ impl Token {

/// Returns `true` if the token is an interpolated path.
fn is_path(&self) -> bool {
if let Interpolated(nt) = &self.kind && let NtPath(..) = &nt.0 {
if let Interpolated(nt) = &self.kind && let NtPath(_) = &nt.0 {
return true;
}

Expand All @@ -640,7 +640,7 @@ impl Token {
/// (which happens while parsing the result of macro expansion)?
pub fn is_whole_expr(&self) -> bool {
if let Interpolated(nt) = &self.kind
&& let NtExpr(..) | NtLiteral(..) | NtPath(..) | NtBlock(..) = &nt.0
&& let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtBlock(_) = &nt.0
{
return true;
}
Expand Down
34 changes: 17 additions & 17 deletions compiler/rustc_parse/src/parser/nonterminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ impl<'a> Parser<'a> {
/// Checks whether the non-terminal may contain a single (non-keyword) identifier.
fn may_be_ident(nt: &token::Nonterminal) -> bool {
match nt {
NtStmt(..)
| NtPat(..)
| NtExpr(..)
| NtTy(..)
NtStmt(_)
| NtPat(_)
| NtExpr(_)
| NtTy(_)
| NtIdent(..)
| NtLiteral(..) // `true`, `false`
| NtMeta(..)
| NtPath(..) => true,
| NtLiteral(_) // `true`, `false`
| NtMeta(_)
| NtPath(_) => true,

NtItem(..)
| NtBlock(..)
| NtVis(..)
| NtLifetime(..) => false,
NtItem(_)
| NtBlock(_)
| NtVis(_)
| NtLifetime(_) => false,
}
}

Expand All @@ -50,15 +50,15 @@ impl<'a> Parser<'a> {
NonterminalKind::Literal => token.can_begin_literal_maybe_minus(),
NonterminalKind::Vis => match token.kind {
// The follow-set of :vis + "priv" keyword + interpolated
token::Comma | token::Ident(..) | token::Interpolated(..) => true,
token::Comma | token::Ident(..) | token::Interpolated(_) => true,
_ => token.can_begin_type(),
},
NonterminalKind::Block => match &token.kind {
token::OpenDelim(Delimiter::Brace) => true,
token::Interpolated(nt) => match &nt.0 {
NtBlock(..) | NtLifetime(..) | NtStmt(..) | NtExpr(..) | NtLiteral(..) => true,
NtItem(..) | NtPat(..) | NtTy(..) | NtIdent(..) | NtMeta(..) | NtPath(..)
| NtVis(..) => false,
NtBlock(_) | NtLifetime(_) | NtStmt(_) | NtExpr(_) | NtLiteral(_) => true,
NtItem(_) | NtPat(_) | NtTy(_) | NtIdent(..) | NtMeta(_) | NtPath(_)
| NtVis(_) => false,
},
_ => false,
},
Expand All @@ -75,7 +75,7 @@ impl<'a> Parser<'a> {
token::BinOp(token::And) | // reference
token::BinOp(token::Minus) | // negative literal
token::AndAnd | // double reference
token::Literal(..) | // literal
token::Literal(_) | // literal
token::DotDot | // range pattern (future compat)
token::DotDotDot | // range pattern (future compat)
token::ModSep | // path
Expand All @@ -90,7 +90,7 @@ impl<'a> Parser<'a> {
NonterminalKind::Lifetime => match &token.kind {
token::Lifetime(_) => true,
token::Interpolated(nt) => {
matches!(&nt.0, NtLifetime(..))
matches!(&nt.0, NtLifetime(_))
}
_ => false,
},
Expand Down

0 comments on commit bb992a2

Please sign in to comment.