Skip to content

Commit

Permalink
Reduce use of custom_keyword for parsing builtin expr
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 22, 2024
1 parent 76092cf commit f6622f1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,6 @@ pub(crate) mod parsing {
use proc_macro2::TokenStream;
use std::mem;

mod kw {
crate::custom_keyword!(builtin);
}

// When we're parsing expressions which occur before blocks, like in an if
// statement's condition, we cannot parse a struct literal.
//
Expand Down Expand Up @@ -1767,7 +1763,8 @@ pub(crate) mod parsing {
|| input.peek(Token![async]) && (input.peek2(Token![|]) || input.peek2(Token![move]))
{
expr_closure(input, allow_struct).map(Expr::Closure)
} else if input.peek(kw::builtin) && input.peek2(Token![#]) {
} else if token::parsing::peek_keyword(input.cursor(), "builtin") && input.peek2(Token![#])
{
expr_builtin(input)
} else if input.peek(Ident)
|| input.peek(Token![::])
Expand Down Expand Up @@ -1884,7 +1881,7 @@ pub(crate) mod parsing {
fn expr_builtin(input: ParseStream) -> Result<Expr> {
let begin = input.fork();

input.parse::<kw::builtin>()?;
token::parsing::keyword(input, "builtin")?;
input.parse::<Token![#]>()?;
input.parse::<Ident>()?;

Expand Down

0 comments on commit f6622f1

Please sign in to comment.