Skip to content

Commit a81d020

Browse files
Even more inlines
1 parent 13a2546 commit a81d020

File tree

1 file changed

+11
-1
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+11
-1
lines changed

compiler/rustc_parse/src/parser/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ impl<'a> Parser<'a> {
562562
///
563563
/// the main purpose of this function is to reduce the cluttering of the suggestions list
564564
/// which using the normal eat method could introduce in some cases.
565+
#[inline]
565566
pub fn eat_noexpect(&mut self, tok: &TokenKind) -> bool {
566567
let is_present = self.check_noexpect(tok);
567568
if is_present {
@@ -582,11 +583,13 @@ impl<'a> Parser<'a> {
582583

583584
/// If the next token is the given keyword, returns `true` without eating it.
584585
/// An expectation is also added for diagnostics purposes.
586+
#[inline]
585587
fn check_keyword(&mut self, kw: Symbol) -> bool {
586588
self.expected_tokens.push(TokenType::Keyword(kw));
587589
self.token.is_keyword(kw)
588590
}
589591

592+
#[inline]
590593
fn check_keyword_case(&mut self, kw: Symbol, case: Case) -> bool {
591594
if self.check_keyword(kw) {
592595
return true;
@@ -605,6 +608,7 @@ impl<'a> Parser<'a> {
605608
/// If the next token is the given keyword, eats it and returns `true`.
606609
/// Otherwise, returns `false`. An expectation is also added for diagnostics purposes.
607610
// Public for rustfmt usage.
611+
#[inline]
608612
pub fn eat_keyword(&mut self, kw: Symbol) -> bool {
609613
if self.check_keyword(kw) {
610614
self.bump();
@@ -617,6 +621,7 @@ impl<'a> Parser<'a> {
617621
/// Eats a keyword, optionally ignoring the case.
618622
/// If the case differs (and is ignored) an error is issued.
619623
/// This is useful for recovery.
624+
#[inline]
620625
fn eat_keyword_case(&mut self, kw: Symbol, case: Case) -> bool {
621626
if self.eat_keyword(kw) {
622627
return true;
@@ -634,6 +639,7 @@ impl<'a> Parser<'a> {
634639
false
635640
}
636641

642+
#[inline]
637643
fn eat_keyword_noexpect(&mut self, kw: Symbol) -> bool {
638644
if self.token.is_keyword(kw) {
639645
self.bump();
@@ -655,6 +661,7 @@ impl<'a> Parser<'a> {
655661
self.token.is_keyword(kw) && self.look_ahead(1, |t| t.is_ident() && !t.is_reserved_ident())
656662
}
657663

664+
#[inline]
658665
fn check_or_expected(&mut self, ok: bool, typ: TokenType) -> bool {
659666
if ok {
660667
true
@@ -702,6 +709,7 @@ impl<'a> Parser<'a> {
702709

703710
/// Checks to see if the next token is either `+` or `+=`.
704711
/// Otherwise returns `false`.
712+
#[inline]
705713
fn check_plus(&mut self) -> bool {
706714
self.check_or_expected(
707715
self.token.is_like_plus(),
@@ -742,6 +750,7 @@ impl<'a> Parser<'a> {
742750
}
743751

744752
/// Eats `+` possibly breaking tokens like `+=` in process.
753+
#[inline]
745754
fn eat_plus(&mut self) -> bool {
746755
self.break_and_eat(token::BinOp(token::Plus))
747756
}
@@ -759,6 +768,7 @@ impl<'a> Parser<'a> {
759768
}
760769

761770
/// Eats `<` possibly breaking tokens like `<<` in process.
771+
#[inline]
762772
fn eat_lt(&mut self) -> bool {
763773
let ate = self.break_and_eat(token::Lt);
764774
if ate {
@@ -1374,7 +1384,6 @@ impl<'a> Parser<'a> {
13741384
/// Evaluates the closure with restrictions in place.
13751385
///
13761386
/// Afters the closure is evaluated, restrictions are reset.
1377-
#[inline]
13781387
fn with_res<T>(&mut self, res: Restrictions, f: impl FnOnce(&mut Self) -> T) -> T {
13791388
let old = self.restrictions;
13801389
self.restrictions = res;
@@ -1509,6 +1518,7 @@ impl<'a> Parser<'a> {
15091518
}
15101519

15111520
/// `::{` or `::*`
1521+
#[inline]
15121522
fn is_import_coupler(&mut self) -> bool {
15131523
self.check(&token::ModSep)
15141524
&& self.look_ahead(1, |t| {

0 commit comments

Comments
 (0)