From 883edd002eaddc138a402918d0d765278e9bc2c9 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 19 Sep 2019 15:51:46 -0400 Subject: Replace usages of bump_any with bump --- crates/ra_parser/src/grammar.rs | 14 +++++------ crates/ra_parser/src/grammar/attributes.rs | 4 +-- crates/ra_parser/src/grammar/expressions.rs | 20 +++++++-------- crates/ra_parser/src/grammar/expressions/atom.rs | 32 ++++++++++++------------ crates/ra_parser/src/grammar/items.rs | 18 ++++++------- crates/ra_parser/src/grammar/items/consts.rs | 2 +- crates/ra_parser/src/grammar/items/nominal.rs | 12 ++++----- crates/ra_parser/src/grammar/items/traits.rs | 8 +++--- crates/ra_parser/src/grammar/items/use_item.rs | 6 ++--- crates/ra_parser/src/grammar/params.rs | 2 +- crates/ra_parser/src/grammar/patterns.rs | 14 +++++------ crates/ra_parser/src/grammar/type_args.rs | 2 +- crates/ra_parser/src/grammar/type_params.rs | 18 ++++++------- crates/ra_parser/src/grammar/types.rs | 22 ++++++++-------- 14 files changed, 87 insertions(+), 87 deletions(-) diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 0158f9b8a..e2355aff9 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs @@ -212,7 +212,7 @@ fn opt_visibility(p: &mut Parser) -> bool { // fn foo() { crate::foo(); } T![crate] if !p.nth_at(1, T![::]) => { let m = p.start(); - p.bump_any(); + p.bump(T![crate]); m.complete(p, VISIBILITY); } _ => return false, @@ -223,7 +223,7 @@ fn opt_visibility(p: &mut Parser) -> bool { fn opt_alias(p: &mut Parser) { if p.at(T![as]) { let m = p.start(); - p.bump_any(); + p.bump(T![as]); if !p.eat(T![_]) { name(p); } @@ -234,7 +234,7 @@ fn opt_alias(p: &mut Parser) { fn abi(p: &mut Parser) { assert!(p.at(T![extern])); let abi = p.start(); - p.bump_any(); + p.bump(T![extern]); match p.current() { STRING | RAW_STRING => p.bump_any(), _ => (), @@ -257,7 +257,7 @@ fn opt_fn_ret_type(p: &mut Parser) -> bool { fn name_r(p: &mut Parser, recovery: TokenSet) { if p.at(IDENT) { let m = p.start(); - p.bump_any(); + p.bump(IDENT); m.complete(p, NAME); } else { p.err_recover("expected a name", recovery); @@ -271,11 +271,11 @@ fn name(p: &mut Parser) { fn name_ref(p: &mut Parser) { if p.at(IDENT) { let m = p.start(); - p.bump_any(); + p.bump(IDENT); m.complete(p, NAME_REF); } else if p.at(T![self]) { let m = p.start(); - p.bump_any(); + p.bump(T![self]); m.complete(p, T![self]); } else { p.err_and_bump("expected identifier"); @@ -296,7 +296,7 @@ fn error_block(p: &mut Parser, message: &str) { assert!(p.at(T!['{'])); let m = p.start(); p.error(message); - p.bump_any(); + p.bump(T!['{']); expressions::expr_block_contents(p); p.eat(T!['}']); m.complete(p, ERROR); diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/ra_parser/src/grammar/attributes.rs index 81a363a57..1cfd301b5 100644 --- a/crates/ra_parser/src/grammar/attributes.rs +++ b/crates/ra_parser/src/grammar/attributes.rs @@ -15,11 +15,11 @@ pub(super) fn outer_attributes(p: &mut Parser) { fn attribute(p: &mut Parser, inner: bool) { let attr = p.start(); assert!(p.at(T![#])); - p.bump_any(); + p.bump(T![#]); if inner { assert!(p.at(T![!])); - p.bump_any(); + p.bump(T![!]); } if p.at(T!['[']) { diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 1dd9a586c..80b085280 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs @@ -43,7 +43,7 @@ pub(crate) fn block(p: &mut Parser) { pub(crate) fn naked_block(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); expr_block_contents(p); p.expect(T!['}']); m.complete(p, BLOCK); @@ -150,7 +150,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) { // } fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) { assert!(p.at(T![let])); - p.bump_any(); + p.bump(T![let]); patterns::pattern(p); if p.at(T![:]) { types::ascription(p); @@ -195,7 +195,7 @@ pub(crate) fn expr_block_contents(p: &mut Parser) { // } if p.at(T![;]) { - p.bump_any(); + p.bump(T![;]); continue; } @@ -297,7 +297,7 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> // } T![&] => { m = p.start(); - p.bump_any(); + p.bump(T![&]); p.eat(T![mut]); REF_EXPR } @@ -438,7 +438,7 @@ fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { fn index_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(T!['['])); let m = lhs.precede(p); - p.bump_any(); + p.bump(T!['[']); expr(p); p.expect(T![']']); m.complete(p, INDEX_EXPR) @@ -478,7 +478,7 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(T![.])); let m = lhs.precede(p); - p.bump_any(); + p.bump(T![.]); if p.at(IDENT) || p.at(INT_NUMBER) { name_ref_or_index(p) } else if p.at(FLOAT_NUMBER) { @@ -497,7 +497,7 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(T![?])); let m = lhs.precede(p); - p.bump_any(); + p.bump(T![?]); m.complete(p, TRY_EXPR) } @@ -511,7 +511,7 @@ fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(T![as])); let m = lhs.precede(p); - p.bump_any(); + p.bump(T![as]); // Use type_no_bounds(), because cast expressions are not // allowed to have bounds. types::type_no_bounds(p); @@ -521,7 +521,7 @@ fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { fn arg_list(p: &mut Parser) { assert!(p.at(T!['('])); let m = p.start(); - p.bump_any(); + p.bump(T!['(']); while !p.at(T![')']) && !p.at(EOF) { if !p.at_ts(EXPR_FIRST) { p.error("expected expression"); @@ -570,7 +570,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { pub(crate) fn record_field_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { match p.current() { // test record_literal_field_with_attr diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 6e295fbf9..6c7fdc2cd 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs @@ -101,14 +101,14 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar } T![async] if la == T!['{'] || (la == T![move] && p.nth(2) == T!['{']) => { let m = p.start(); - p.bump_any(); + p.bump(T![async]); p.eat(T![move]); block_expr(p, Some(m)) } T![match] => match_expr(p), T![unsafe] if la == T!['{'] => { let m = p.start(); - p.bump_any(); + p.bump(T![unsafe]); block_expr(p, Some(m)) } T!['{'] => { @@ -180,7 +180,7 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { fn array_expr(p: &mut Parser) -> CompletedMarker { assert!(p.at(T!['['])); let m = p.start(); - p.bump_any(); + p.bump(T!['[']); if p.eat(T![']']) { return m.complete(p, ARRAY_EXPR); } @@ -262,11 +262,11 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { fn if_expr(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![if])); let m = p.start(); - p.bump_any(); + p.bump(T![if]); cond(p); block(p); if p.at(T![else]) { - p.bump_any(); + p.bump(T![else]); if p.at(T![if]) { if_expr(p); } else { @@ -285,7 +285,7 @@ fn if_expr(p: &mut Parser) -> CompletedMarker { fn label(p: &mut Parser) { assert!(p.at(LIFETIME) && p.nth(1) == T![:]); let m = p.start(); - p.bump_any(); + p.bump(LIFETIME); p.bump_any(); m.complete(p, LABEL); } @@ -297,7 +297,7 @@ fn label(p: &mut Parser) { fn loop_expr(p: &mut Parser, m: Option) -> CompletedMarker { assert!(p.at(T![loop])); let m = m.unwrap_or_else(|| p.start()); - p.bump_any(); + p.bump(T![loop]); block(p); m.complete(p, LOOP_EXPR) } @@ -310,7 +310,7 @@ fn loop_expr(p: &mut Parser, m: Option) -> CompletedMarker { fn while_expr(p: &mut Parser, m: Option) -> CompletedMarker { assert!(p.at(T![while])); let m = m.unwrap_or_else(|| p.start()); - p.bump_any(); + p.bump(T![while]); cond(p); block(p); m.complete(p, WHILE_EXPR) @@ -323,7 +323,7 @@ fn while_expr(p: &mut Parser, m: Option) -> CompletedMarker { fn for_expr(p: &mut Parser, m: Option) -> CompletedMarker { assert!(p.at(T![for])); let m = m.unwrap_or_else(|| p.start()); - p.bump_any(); + p.bump(T![for]); patterns::pattern(p); p.expect(T![in]); expr_no_struct(p); @@ -357,7 +357,7 @@ fn cond(p: &mut Parser) { fn match_expr(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![match])); let m = p.start(); - p.bump_any(); + p.bump(T![match]); expr_no_struct(p); if p.at(T!['{']) { match_arm_list(p); @@ -453,7 +453,7 @@ fn match_arm(p: &mut Parser) -> BlockLike { fn match_guard(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![if])); let m = p.start(); - p.bump_any(); + p.bump(T![if]); expr(p); m.complete(p, MATCH_GUARD) } @@ -479,7 +479,7 @@ pub(super) fn block_expr(p: &mut Parser, m: Option) -> CompletedMarker { fn return_expr(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![return])); let m = p.start(); - p.bump_any(); + p.bump(T![return]); if p.at_ts(EXPR_FIRST) { expr(p); } @@ -496,7 +496,7 @@ fn return_expr(p: &mut Parser) -> CompletedMarker { fn continue_expr(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![continue])); let m = p.start(); - p.bump_any(); + p.bump(T![continue]); p.eat(LIFETIME); m.complete(p, CONTINUE_EXPR) } @@ -513,7 +513,7 @@ fn continue_expr(p: &mut Parser) -> CompletedMarker { fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { assert!(p.at(T![break])); let m = p.start(); - p.bump_any(); + p.bump(T![break]); p.eat(LIFETIME); // test break_ambiguity // fn foo(){ @@ -535,7 +535,7 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { fn try_block_expr(p: &mut Parser, m: Option) -> CompletedMarker { assert!(p.at(T![try])); let m = m.unwrap_or_else(|| p.start()); - p.bump_any(); + p.bump(T![try]); block(p); m.complete(p, TRY_EXPR) } @@ -549,7 +549,7 @@ fn try_block_expr(p: &mut Parser, m: Option) -> CompletedMarker { fn box_expr(p: &mut Parser, m: Option) -> CompletedMarker { assert!(p.at(T![box])); let m = m.unwrap_or_else(|| p.start()); - p.bump_any(); + p.bump(T![box]); if p.at_ts(EXPR_FIRST) { expr(p); } diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 4dd80d443..4c67a5c2e 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -64,7 +64,7 @@ pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemF } else if p.at(T!['}']) && !stop_on_r_curly { let e = p.start(); p.error("unmatched `}`"); - p.bump_any(); + p.bump(T!['}']); e.complete(p, ERROR); } else if !p.at(EOF) && !p.at(T!['}']) { p.err_and_bump("expected an item"); @@ -276,9 +276,9 @@ fn items_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> { fn extern_crate_item(p: &mut Parser, m: Marker) { assert!(p.at(T![extern])); - p.bump_any(); + p.bump(T![extern]); assert!(p.at(T![crate])); - p.bump_any(); + p.bump(T![crate]); name_ref(p); opt_alias(p); p.expect(T![;]); @@ -288,7 +288,7 @@ fn extern_crate_item(p: &mut Parser, m: Marker) { pub(crate) fn extern_item_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); mod_contents(p, true); p.expect(T!['}']); m.complete(p, EXTERN_ITEM_LIST); @@ -296,7 +296,7 @@ pub(crate) fn extern_item_list(p: &mut Parser) { fn fn_def(p: &mut Parser, flavor: ItemFlavor) { assert!(p.at(T![fn])); - p.bump_any(); + p.bump(T![fn]); name_r(p, ITEM_RECOVERY_SET); // test function_type_params @@ -323,7 +323,7 @@ fn fn_def(p: &mut Parser, flavor: ItemFlavor) { // test fn_decl // trait T { fn foo(); } if p.at(T![;]) { - p.bump_any(); + p.bump(T![;]); } else { expressions::block(p) } @@ -333,7 +333,7 @@ fn fn_def(p: &mut Parser, flavor: ItemFlavor) { // type Foo = Bar; fn type_def(p: &mut Parser, m: Marker) { assert!(p.at(T![type])); - p.bump_any(); + p.bump(T![type]); name(p); @@ -357,7 +357,7 @@ fn type_def(p: &mut Parser, m: Marker) { pub(crate) fn mod_item(p: &mut Parser, m: Marker) { assert!(p.at(T![mod])); - p.bump_any(); + p.bump(T![mod]); name(p); if p.at(T!['{']) { @@ -371,7 +371,7 @@ pub(crate) fn mod_item(p: &mut Parser, m: Marker) { pub(crate) fn mod_item_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); mod_contents(p, true); p.expect(T!['}']); m.complete(p, ITEM_LIST); diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs index 63e0e6e0c..310260689 100644 --- a/crates/ra_parser/src/grammar/items/consts.rs +++ b/crates/ra_parser/src/grammar/items/consts.rs @@ -10,7 +10,7 @@ pub(super) fn const_def(p: &mut Parser, m: Marker) { fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { assert!(p.at(kw)); - p.bump_any(); + p.bump(kw); p.eat(T![mut]); // FIXME: validator to forbid const mut // Allow `_` in place of an identifier in a `const`. diff --git a/crates/ra_parser/src/grammar/items/nominal.rs b/crates/ra_parser/src/grammar/items/nominal.rs index 460acd65e..bede3b692 100644 --- a/crates/ra_parser/src/grammar/items/nominal.rs +++ b/crates/ra_parser/src/grammar/items/nominal.rs @@ -11,7 +11,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { type_params::opt_where_clause(p); match p.current() { T![;] => { - p.bump_any(); + p.bump(T![;]); } T!['{'] => record_field_def_list(p), _ => { @@ -21,7 +21,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { } } T![;] if kind == T![struct] => { - p.bump_any(); + p.bump(T![;]); } T!['{'] => record_field_def_list(p), T!['('] if kind == T![struct] => { @@ -44,7 +44,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { pub(super) fn enum_def(p: &mut Parser, m: Marker) { assert!(p.at(T![enum])); - p.bump_any(); + p.bump(T![enum]); name_r(p, ITEM_RECOVERY_SET); type_params::opt_type_param_list(p); type_params::opt_where_clause(p); @@ -59,7 +59,7 @@ pub(super) fn enum_def(p: &mut Parser, m: Marker) { pub(crate) fn enum_variant_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { if p.at(T!['{']) { error_block(p, "expected enum variant"); @@ -73,7 +73,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { T!['{'] => record_field_def_list(p), T!['('] => tuple_field_def_list(p), T![=] => { - p.bump_any(); + p.bump(T![=]); expressions::expr(p); } _ => (), @@ -94,7 +94,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { pub(crate) fn record_field_def_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); while !p.at(T!['}']) && !p.at(EOF) { if p.at(T!['{']) { error_block(p, "expected field"); diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs index b49221a4b..3742fd197 100644 --- a/crates/ra_parser/src/grammar/items/traits.rs +++ b/crates/ra_parser/src/grammar/items/traits.rs @@ -5,7 +5,7 @@ use super::*; // trait X: Hash + Clone where U: Copy {} pub(super) fn trait_def(p: &mut Parser) { assert!(p.at(T![trait])); - p.bump_any(); + p.bump(T![trait]); name_r(p, ITEM_RECOVERY_SET); type_params::opt_type_param_list(p); if p.at(T![:]) { @@ -29,7 +29,7 @@ pub(super) fn trait_def(p: &mut Parser) { pub(crate) fn trait_item_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { if p.at(T!['{']) { error_block(p, "expected an item"); @@ -45,7 +45,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) { // impl Foo {} pub(super) fn impl_block(p: &mut Parser) { assert!(p.at(T![impl])); - p.bump_any(); + p.bump(T![impl]); if choose_type_params_over_qpath(p) { type_params::opt_type_param_list(p); } @@ -78,7 +78,7 @@ pub(super) fn impl_block(p: &mut Parser) { pub(crate) fn impl_item_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); // test impl_inner_attributes // enum F{} // impl F { diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/ra_parser/src/grammar/items/use_item.rs index f28f522b8..2af2ad315 100644 --- a/crates/ra_parser/src/grammar/items/use_item.rs +++ b/crates/ra_parser/src/grammar/items/use_item.rs @@ -2,7 +2,7 @@ use super::*; pub(super) fn use_item(p: &mut Parser, m: Marker) { assert!(p.at(T![use])); - p.bump_any(); + p.bump(T![use]); use_tree(p); p.expect(T![;]); m.complete(p, USE_ITEM); @@ -84,7 +84,7 @@ fn use_tree(p: &mut Parser) { p.bump(T![::]); match p.current() { T![*] => { - p.bump_any(); + p.bump(T![*]); } // test use_tree_list_after_path // use crate::{Item}; @@ -114,7 +114,7 @@ fn use_tree(p: &mut Parser) { pub(crate) fn use_tree_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { use_tree(p); if !p.at(T!['}']) { diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs index 5893b22fd..efc329243 100644 --- a/crates/ra_parser/src/grammar/params.rs +++ b/crates/ra_parser/src/grammar/params.rs @@ -39,7 +39,7 @@ fn list_(p: &mut Parser, flavor: Flavor) { let (bra, ket) = if flavor.type_required() { (T!['('], T![')']) } else { (T![|], T![|]) }; assert!(p.at(bra)); let m = p.start(); - p.bump_any(); + p.bump(bra); if flavor.type_required() { // test self_param_outer_attr // fn f(#[must_use] self) {} diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 919b0f37d..a4ffd6960 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs @@ -106,7 +106,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker { assert!(is_literal_pat_start(p)); let m = p.start(); if p.at(T![-]) { - p.bump_any(); + p.bump(T![-]); } expressions::literal(p); m.complete(p, LITERAL_PAT) @@ -146,7 +146,7 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { // } fn tuple_pat_fields(p: &mut Parser) { assert!(p.at(T!['('])); - p.bump_any(); + p.bump(T!['(']); pat_list(p, T![')']); p.expect(T![')']); } @@ -161,7 +161,7 @@ fn tuple_pat_fields(p: &mut Parser) { fn record_field_pat_list(p: &mut Parser) { assert!(p.at(T!['{'])); let m = p.start(); - p.bump_any(); + p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { match p.current() { // A trailing `..` is *not* treated as a DOT_DOT_PAT. @@ -200,7 +200,7 @@ fn record_field_pat(p: &mut Parser) { fn placeholder_pat(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![_])); let m = p.start(); - p.bump_any(); + p.bump(T![_]); m.complete(p, PLACEHOLDER_PAT) } @@ -245,7 +245,7 @@ fn dot_dot_pat(p: &mut Parser) -> CompletedMarker { fn ref_pat(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![&])); let m = p.start(); - p.bump_any(); + p.bump(T![&]); p.eat(T![mut]); pattern(p); m.complete(p, REF_PAT) @@ -269,7 +269,7 @@ fn tuple_pat(p: &mut Parser) -> CompletedMarker { fn slice_pat(p: &mut Parser) -> CompletedMarker { assert!(p.at(T!['['])); let m = p.start(); - p.bump_any(); + p.bump(T!['[']); pat_list(p, T![']']); p.expect(T![']']); m.complete(p, SLICE_PAT) @@ -318,7 +318,7 @@ fn bind_pat(p: &mut Parser, with_at: bool) -> CompletedMarker { fn box_pat(p: &mut Parser) -> CompletedMarker { assert!(p.at(T![box])); let m = p.start(); - p.bump_any(); + p.bump(T![box]); pattern(p); m.complete(p, BOX_PAT) } diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/ra_parser/src/grammar/type_args.rs index edc7d4ff2..8e97fe03c 100644 --- a/crates/ra_parser/src/grammar/type_args.rs +++ b/crates/ra_parser/src/grammar/type_args.rs @@ -29,7 +29,7 @@ fn type_arg(p: &mut Parser) { let m = p.start(); match p.current() { LIFETIME => { - p.bump_any(); + p.bump(LIFETIME); m.complete(p, LIFETIME_ARG); } // test associated_type_bounds diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs index 31d709d81..7071c70ea 100644 --- a/crates/ra_parser/src/grammar/type_params.rs +++ b/crates/ra_parser/src/grammar/type_params.rs @@ -10,7 +10,7 @@ pub(super) fn opt_type_param_list(p: &mut Parser) { fn type_param_list(p: &mut Parser) { assert!(p.at(T![<])); let m = p.start(); - p.bump_any(); + p.bump(T![<]); while !p.at(EOF) && !p.at(T![>]) { let m = p.start(); @@ -38,7 +38,7 @@ fn type_param_list(p: &mut Parser) { fn lifetime_param(p: &mut Parser, m: Marker) { assert!(p.at(LIFETIME)); - p.bump_any(); + p.bump(LIFETIME); if p.at(T![:]) { lifetime_bounds(p); } @@ -54,7 +54,7 @@ fn type_param(p: &mut Parser, m: Marker) { // test type_param_default // struct S; if p.at(T![=]) { - p.bump_any(); + p.bump(T![=]); types::type_(p) } m.complete(p, TYPE_PARAM); @@ -64,15 +64,15 @@ fn type_param(p: &mut Parser, m: Marker) { // struct S; pub(super) fn bounds(p: &mut Parser) { assert!(p.at(T![:])); - p.bump_any(); + p.bump(T![:]); bounds_without_colon(p); } fn lifetime_bounds(p: &mut Parser) { assert!(p.at(T![:])); - p.bump_any(); + p.bump(T![:]); while p.at(LIFETIME) { - p.bump_any(); + p.bump(LIFETIME); if !p.eat(T![+]) { break; } @@ -99,7 +99,7 @@ fn type_bound(p: &mut Parser) -> bool { let has_paren = p.eat(T!['(']); p.eat(T![?]); match p.current() { - LIFETIME => p.bump_any(), + LIFETIME => p.bump(LIFETIME), T![for] => types::for_type(p), _ if paths::is_use_path_start(p) => types::path_type_(p, false), _ => { @@ -128,7 +128,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) { return; } let m = p.start(); - p.bump_any(); + p.bump(T![where]); while is_where_predicate(p) { where_predicate(p); @@ -166,7 +166,7 @@ fn where_predicate(p: &mut Parser) { let m = p.start(); match p.current() { LIFETIME => { - p.bump_any(); + p.bump(LIFETIME); if p.at(T![:]) { bounds(p); } else { diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 0eb28ef09..bd3829f41 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs @@ -44,7 +44,7 @@ pub(super) fn ascription(p: &mut Parser) { fn paren_or_tuple_type(p: &mut Parser) { assert!(p.at(T!['('])); let m = p.start(); - p.bump_any(); + p.bump(T!['(']); let mut n_types: u32 = 0; let mut trailing_comma: bool = false; while !p.at(EOF) && !p.at(T![')']) { @@ -79,14 +79,14 @@ fn paren_or_tuple_type(p: &mut Parser) { fn never_type(p: &mut Parser) { assert!(p.at(T![!])); let m = p.start(); - p.bump_any(); + p.bump(T![!]); m.complete(p, NEVER_TYPE); } fn pointer_type(p: &mut Parser) { assert!(p.at(T![*])); let m = p.start(); - p.bump_any(); + p.bump(T![*]); match p.current() { // test pointer_type_mut @@ -110,21 +110,21 @@ fn pointer_type(p: &mut Parser) { fn array_or_slice_type(p: &mut Parser) { assert!(p.at(T!['['])); let m = p.start(); - p.bump_any(); + p.bump(T!['[']); type_(p); let kind = match p.current() { // test slice_type // type T = [()]; T![']'] => { - p.bump_any(); + p.bump(T![']']); SLICE_TYPE } // test array_type // type T = [(); 92]; T![;] => { - p.bump_any(); + p.bump(T![;]); expressions::expr(p); p.expect(T![']']); ARRAY_TYPE @@ -146,7 +146,7 @@ fn array_or_slice_type(p: &mut Parser) { fn reference_type(p: &mut Parser) { assert!(p.at(T![&])); let m = p.start(); - p.bump_any(); + p.bump(T![&]); p.eat(LIFETIME); p.eat(T![mut]); type_no_bounds(p); @@ -158,7 +158,7 @@ fn reference_type(p: &mut Parser) { fn placeholder_type(p: &mut Parser) { assert!(p.at(T![_])); let m = p.start(); - p.bump_any(); + p.bump(T![_]); m.complete(p, PLACEHOLDER_TYPE); } @@ -193,7 +193,7 @@ fn fn_pointer_type(p: &mut Parser) { pub(super) fn for_binder(p: &mut Parser) { assert!(p.at(T![for])); - p.bump_any(); + p.bump(T![for]); if p.at(T![<]) { type_params::opt_type_param_list(p); } else { @@ -224,7 +224,7 @@ pub(super) fn for_type(p: &mut Parser) { fn impl_trait_type(p: &mut Parser) { assert!(p.at(T![impl])); let m = p.start(); - p.bump_any(); + p.bump(T![impl]); type_params::bounds_without_colon(p); m.complete(p, IMPL_TRAIT_TYPE); } @@ -234,7 +234,7 @@ fn impl_trait_type(p: &mut Parser) { fn dyn_trait_type(p: &mut Parser) { assert!(p.at(T![dyn ])); let m = p.start(); - p.bump_any(); + p.bump(T![dyn ]); type_params::bounds_without_colon(p); m.complete(p, DYN_TRAIT_TYPE); } -- cgit v1.2.3