Skip to content

Commit e046904

Browse files
committed
syntax: de-closure-ify check_or_expected.
1 parent 49780d2 commit e046904

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/libsyntax/parse/parser.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -549,37 +549,37 @@ impl<'a> Parser<'a> {
549549
}
550550
}
551551

552-
fn check_or_expected(&mut self, ok: bool, mk_type: impl FnOnce() -> TokenType) -> bool {
552+
fn check_or_expected(&mut self, ok: bool, typ: TokenType) -> bool {
553553
if ok {
554554
true
555555
} else {
556-
self.expected_tokens.push(mk_type());
556+
self.expected_tokens.push(typ);
557557
false
558558
}
559559
}
560560

561561
crate fn check_ident(&mut self) -> bool {
562-
self.check_or_expected(self.token.is_ident(), || TokenType::Ident)
562+
self.check_or_expected(self.token.is_ident(), TokenType::Ident)
563563
}
564564

565565
fn check_path(&mut self) -> bool {
566-
self.check_or_expected(self.token.is_path_start(), || TokenType::Path)
566+
self.check_or_expected(self.token.is_path_start(), TokenType::Path)
567567
}
568568

569569
fn check_type(&mut self) -> bool {
570-
self.check_or_expected(self.token.can_begin_type(), || TokenType::Type)
570+
self.check_or_expected(self.token.can_begin_type(), TokenType::Type)
571571
}
572572

573573
fn check_const_arg(&mut self) -> bool {
574-
self.check_or_expected(self.token.can_begin_const_arg(), || TokenType::Const)
574+
self.check_or_expected(self.token.can_begin_const_arg(), TokenType::Const)
575575
}
576576

577577
/// Checks to see if the next token is either `+` or `+=`.
578578
/// Otherwise returns `false`.
579579
fn check_plus(&mut self) -> bool {
580580
self.check_or_expected(
581581
self.token.is_like_plus(),
582-
|| TokenType::Token(token::BinOp(token::Plus)),
582+
TokenType::Token(token::BinOp(token::Plus)),
583583
)
584584
}
585585

0 commit comments

Comments
 (0)