diff options
| author | Amos Wenger <amoswenger@gmail.com> | 2022-07-20 15:02:08 +0200 |
|---|---|---|
| committer | Amos Wenger <amoswenger@gmail.com> | 2022-07-20 15:02:08 +0200 |
| commit | 816f7fe12a8584eb4bdd48ff3da8e4fc95f571a0 (patch) | |
| tree | a855b8bf05bb903a03de17a6842d32c89abcea1d /crates/parser/src | |
| parent | 23d25a3094ec89fca610cd2e0d3434e36a4f11ab (diff) | |
| download | rust-816f7fe12a8584eb4bdd48ff3da8e4fc95f571a0.tar.gz rust-816f7fe12a8584eb4bdd48ff3da8e4fc95f571a0.zip | |
Run cargo fix --edition-idioms
Diffstat (limited to 'crates/parser/src')
| -rw-r--r-- | crates/parser/src/grammar.rs | 54 | ||||
| -rw-r--r-- | crates/parser/src/grammar/attributes.rs | 8 | ||||
| -rw-r--r-- | crates/parser/src/grammar/expressions.rs | 42 | ||||
| -rw-r--r-- | crates/parser/src/grammar/expressions/atom.rs | 46 | ||||
| -rw-r--r-- | crates/parser/src/grammar/generic_args.rs | 12 | ||||
| -rw-r--r-- | crates/parser/src/grammar/generic_params.rs | 28 | ||||
| -rw-r--r-- | crates/parser/src/grammar/items.rs | 30 | ||||
| -rw-r--r-- | crates/parser/src/grammar/items/adt.rs | 18 | ||||
| -rw-r--r-- | crates/parser/src/grammar/items/consts.rs | 6 | ||||
| -rw-r--r-- | crates/parser/src/grammar/items/traits.rs | 10 | ||||
| -rw-r--r-- | crates/parser/src/grammar/items/use_item.rs | 6 | ||||
| -rw-r--r-- | crates/parser/src/grammar/params.rs | 18 | ||||
| -rw-r--r-- | crates/parser/src/grammar/paths.rs | 20 | ||||
| -rw-r--r-- | crates/parser/src/grammar/patterns.rs | 44 | ||||
| -rw-r--r-- | crates/parser/src/grammar/types.rs | 38 | ||||
| -rw-r--r-- | crates/parser/src/lib.rs | 6 | ||||
| -rw-r--r-- | crates/parser/src/parser.rs | 8 | ||||
| -rw-r--r-- | crates/parser/src/shortcuts.rs | 2 |
18 files changed, 198 insertions, 198 deletions
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index 4efbf9a606e..b7468329610 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -50,36 +50,36 @@ pub(crate) mod entry { pub(crate) mod prefix { use super::*; - pub(crate) fn vis(p: &mut Parser) { + pub(crate) fn vis(p: &mut Parser<'_>) { let _ = opt_visibility(p, false); } - pub(crate) fn block(p: &mut Parser) { + pub(crate) fn block(p: &mut Parser<'_>) { expressions::block_expr(p); } - pub(crate) fn stmt(p: &mut Parser) { + pub(crate) fn stmt(p: &mut Parser<'_>) { expressions::stmt(p, expressions::Semicolon::Forbidden); } - pub(crate) fn pat(p: &mut Parser) { + pub(crate) fn pat(p: &mut Parser<'_>) { patterns::pattern_single(p); } - pub(crate) fn ty(p: &mut Parser) { + pub(crate) fn ty(p: &mut Parser<'_>) { types::type_(p); } - pub(crate) fn expr(p: &mut Parser) { + pub(crate) fn expr(p: &mut Parser<'_>) { let _ = expressions::expr(p); } - pub(crate) fn path(p: &mut Parser) { + pub(crate) fn path(p: &mut Parser<'_>) { let _ = paths::type_path(p); } - pub(crate) fn item(p: &mut Parser) { + pub(crate) fn item(p: &mut Parser<'_>) { items::item_or_macro(p, true); } // Parse a meta item , which excluded [], e.g : #[ MetaItem ] - pub(crate) fn meta_item(p: &mut Parser) { + pub(crate) fn meta_item(p: &mut Parser<'_>) { attributes::meta(p); } } @@ -87,14 +87,14 @@ pub(crate) mod entry { pub(crate) mod top { use super::*; - pub(crate) fn source_file(p: &mut Parser) { + pub(crate) fn source_file(p: &mut Parser<'_>) { let m = p.start(); p.eat(SHEBANG); items::mod_contents(p, false); m.complete(p, SOURCE_FILE); } - pub(crate) fn macro_stmts(p: &mut Parser) { + pub(crate) fn macro_stmts(p: &mut Parser<'_>) { let m = p.start(); while !p.at(EOF) { @@ -104,13 +104,13 @@ pub(crate) mod entry { m.complete(p, MACRO_STMTS); } - pub(crate) fn macro_items(p: &mut Parser) { + pub(crate) fn macro_items(p: &mut Parser<'_>) { let m = p.start(); items::mod_contents(p, false); m.complete(p, MACRO_ITEMS); } - pub(crate) fn pattern(p: &mut Parser) { + pub(crate) fn pattern(p: &mut Parser<'_>) { let m = p.start(); patterns::pattern_top(p); if p.at(EOF) { @@ -123,7 +123,7 @@ pub(crate) mod entry { m.complete(p, ERROR); } - pub(crate) fn type_(p: &mut Parser) { + pub(crate) fn type_(p: &mut Parser<'_>) { let m = p.start(); types::type_(p); if p.at(EOF) { @@ -136,7 +136,7 @@ pub(crate) mod entry { m.complete(p, ERROR); } - pub(crate) fn expr(p: &mut Parser) { + pub(crate) fn expr(p: &mut Parser<'_>) { let m = p.start(); expressions::expr(p); if p.at(EOF) { @@ -149,7 +149,7 @@ pub(crate) mod entry { m.complete(p, ERROR); } - pub(crate) fn meta_item(p: &mut Parser) { + pub(crate) fn meta_item(p: &mut Parser<'_>) { let m = p.start(); attributes::meta(p); if p.at(EOF) { @@ -168,7 +168,7 @@ pub(crate) fn reparser( node: SyntaxKind, first_child: Option<SyntaxKind>, parent: Option<SyntaxKind>, -) -> Option<fn(&mut Parser)> { +) -> Option<fn(&mut Parser<'_>)> { let res = match node { BLOCK_EXPR => expressions::block_expr, RECORD_FIELD_LIST => items::record_field_list, @@ -200,7 +200,7 @@ impl BlockLike { } } -fn opt_visibility(p: &mut Parser, in_tuple_field: bool) -> bool { +fn opt_visibility(p: &mut Parser<'_>, in_tuple_field: bool) -> bool { match p.current() { T![pub] => { let m = p.start(); @@ -262,7 +262,7 @@ fn opt_visibility(p: &mut Parser, in_tuple_field: bool) -> bool { } } -fn opt_rename(p: &mut Parser) { +fn opt_rename(p: &mut Parser<'_>) { if p.at(T![as]) { let m = p.start(); p.bump(T![as]); @@ -273,7 +273,7 @@ fn opt_rename(p: &mut Parser) { } } -fn abi(p: &mut Parser) { +fn abi(p: &mut Parser<'_>) { assert!(p.at(T![extern])); let abi = p.start(); p.bump(T![extern]); @@ -281,7 +281,7 @@ fn abi(p: &mut Parser) { abi.complete(p, ABI); } -fn opt_ret_type(p: &mut Parser) -> bool { +fn opt_ret_type(p: &mut Parser<'_>) -> bool { if p.at(T![->]) { let m = p.start(); p.bump(T![->]); @@ -293,7 +293,7 @@ fn opt_ret_type(p: &mut Parser) -> bool { } } -fn name_r(p: &mut Parser, recovery: TokenSet) { +fn name_r(p: &mut Parser<'_>, recovery: TokenSet) { if p.at(IDENT) { let m = p.start(); p.bump(IDENT); @@ -303,11 +303,11 @@ fn name_r(p: &mut Parser, recovery: TokenSet) { } } -fn name(p: &mut Parser) { +fn name(p: &mut Parser<'_>) { name_r(p, TokenSet::EMPTY); } -fn name_ref(p: &mut Parser) { +fn name_ref(p: &mut Parser<'_>) { if p.at(IDENT) { let m = p.start(); p.bump(IDENT); @@ -317,21 +317,21 @@ fn name_ref(p: &mut Parser) { } } -fn name_ref_or_index(p: &mut Parser) { +fn name_ref_or_index(p: &mut Parser<'_>) { assert!(p.at(IDENT) || p.at(INT_NUMBER)); let m = p.start(); p.bump_any(); m.complete(p, NAME_REF); } -fn lifetime(p: &mut Parser) { +fn lifetime(p: &mut Parser<'_>) { assert!(p.at(LIFETIME_IDENT)); let m = p.start(); p.bump(LIFETIME_IDENT); m.complete(p, LIFETIME); } -fn error_block(p: &mut Parser, message: &str) { +fn error_block(p: &mut Parser<'_>, message: &str) { assert!(p.at(T!['{'])); let m = p.start(); p.error(message); diff --git a/crates/parser/src/grammar/attributes.rs b/crates/parser/src/grammar/attributes.rs index 1efffca515c..0cf6a16f86a 100644 --- a/crates/parser/src/grammar/attributes.rs +++ b/crates/parser/src/grammar/attributes.rs @@ -1,18 +1,18 @@ use super::*; -pub(super) fn inner_attrs(p: &mut Parser) { +pub(super) fn inner_attrs(p: &mut Parser<'_>) { while p.at(T![#]) && p.nth(1) == T![!] { attr(p, true); } } -pub(super) fn outer_attrs(p: &mut Parser) { +pub(super) fn outer_attrs(p: &mut Parser<'_>) { while p.at(T![#]) { attr(p, false); } } -fn attr(p: &mut Parser, inner: bool) { +fn attr(p: &mut Parser<'_>, inner: bool) { assert!(p.at(T![#])); let attr = p.start(); @@ -34,7 +34,7 @@ fn attr(p: &mut Parser, inner: bool) { attr.complete(p, ATTR); } -pub(super) fn meta(p: &mut Parser) { +pub(super) fn meta(p: &mut Parser<'_>) { let meta = p.start(); paths::use_path(p); diff --git a/crates/parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs index b063c73a9d6..8887f3330bd 100644 --- a/crates/parser/src/grammar/expressions.rs +++ b/crates/parser/src/grammar/expressions.rs @@ -14,17 +14,17 @@ pub(super) enum Semicolon { const EXPR_FIRST: TokenSet = LHS_FIRST; -pub(super) fn expr(p: &mut Parser) -> bool { +pub(super) fn expr(p: &mut Parser<'_>) -> bool { let r = Restrictions { forbid_structs: false, prefer_stmt: false }; expr_bp(p, None, r, 1).is_some() } -pub(super) fn expr_stmt(p: &mut Parser, m: Option<Marker>) -> Option<(CompletedMarker, BlockLike)> { +pub(super) fn expr_stmt(p: &mut Parser<'_>, m: Option<Marker>) -> Option<(CompletedMarker, BlockLike)> { let r = Restrictions { forbid_structs: false, prefer_stmt: true }; expr_bp(p, m, r, 1) } -fn expr_no_struct(p: &mut Parser) { +fn expr_no_struct(p: &mut Parser<'_>) { let r = Restrictions { forbid_structs: true, prefer_stmt: false }; expr_bp(p, None, r, 1); } @@ -33,12 +33,12 @@ fn expr_no_struct(p: &mut Parser) { /// It needs to be parsed with lower precedence than `&&`, so that /// `if let true = true && false` is parsed as `if (let true = true) && (true)` /// and not `if let true = (true && true)`. -fn expr_let(p: &mut Parser) { +fn expr_let(p: &mut Parser<'_>) { let r = Restrictions { forbid_structs: true, prefer_stmt: false }; expr_bp(p, None, r, 5); } -pub(super) fn stmt(p: &mut Parser, semicolon: Semicolon) { +pub(super) fn stmt(p: &mut Parser<'_>, semicolon: Semicolon) { if p.eat(T![;]) { return; } @@ -101,7 +101,7 @@ pub(super) fn stmt(p: &mut Parser, semicolon: Semicolon) { // test let_stmt // fn f() { let x: i32 = 92; } - fn let_stmt(p: &mut Parser, m: Marker, with_semi: Semicolon) { + fn let_stmt(p: &mut Parser<'_>, m: Marker, with_semi: Semicolon) { p.bump(T![let]); patterns::pattern(p); if p.at(T![:]) { @@ -138,7 +138,7 @@ pub(super) fn stmt(p: &mut Parser, semicolon: Semicolon) { } } -pub(super) fn expr_block_contents(p: &mut Parser) { +pub(super) fn expr_block_contents(p: &mut Parser<'_>) { attributes::inner_attrs(p); while !p.at(EOF) && !p.at(T!['}']) { @@ -170,7 +170,7 @@ struct Restrictions { /// /// See <https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html> #[rustfmt::skip] -fn current_op(p: &Parser) -> (u8, SyntaxKind) { +fn current_op(p: &Parser<'_>) -> (u8, SyntaxKind) { const NOT_AN_OP: (u8, SyntaxKind) = (0, T![@]); match p.current() { T![|] if p.at(T![||]) => (3, T![||]), @@ -214,7 +214,7 @@ fn current_op(p: &Parser) -> (u8, SyntaxKind) { // Parses expression with binding power of at least bp. fn expr_bp( - p: &mut Parser, + p: &mut Parser<'_>, m: Option<Marker>, mut r: Restrictions, bp: u8, @@ -287,7 +287,7 @@ fn expr_bp( const LHS_FIRST: TokenSet = atom::ATOM_EXPR_FIRST.union(TokenSet::new(&[T![&], T![*], T![!], T![.], T![-]])); -fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { +fn lhs(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { let m; let kind = match p.current() { // test ref_expr @@ -356,7 +356,7 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> } fn postfix_expr( - p: &mut Parser, + p: &mut Parser<'_>, mut lhs: CompletedMarker, // Calls are disallowed if the type is a block and we prefer statements because the call cannot be disambiguated from a tuple // E.g. `while true {break}();` is parsed as @@ -392,7 +392,7 @@ fn postfix_expr( return (lhs, block_like); fn postfix_dot_expr( - p: &mut Parser, + p: &mut Parser<'_>, lhs: CompletedMarker, ) -> Result<CompletedMarker, CompletedMarker> { assert!(p.at(T![.])); @@ -428,7 +428,7 @@ fn postfix_expr( // let _ = f(<Foo>::func()); // f(<Foo as Trait>::func()); // } -fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { +fn call_expr(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(T!['('])); let m = lhs.precede(p); arg_list(p); @@ -439,7 +439,7 @@ fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { // fn foo() { // x[1][2]; // } -fn index_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(T!['[']); @@ -453,7 +453,7 @@ fn index_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { // x.foo(); // y.bar::<T>(1, 2,); // } -fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { +fn method_call_expr(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(T![.]) && p.nth(1) == IDENT && (p.nth(2) == T!['('] || p.nth_at(2, T![::]))); let m = lhs.precede(p); p.bump_any(); @@ -471,7 +471,7 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { // x.0.bar; // x.0(); // } -fn field_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(T![.]); @@ -490,7 +490,7 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { // fn foo() { // x?; // } -fn try_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(T![?]); @@ -504,7 +504,7 @@ fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { // 79 as i16 - 1; // 0x36 as u8 <= 0x37; // } -fn cast_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(T![as]); @@ -514,7 +514,7 @@ fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { m.complete(p, CAST_EXPR) } -fn arg_list(p: &mut Parser) { +fn arg_list(p: &mut Parser<'_>) { assert!(p.at(T!['('])); let m = p.start(); p.bump(T!['(']); @@ -541,7 +541,7 @@ fn arg_list(p: &mut Parser) { // let _ = ::a::<b>; // let _ = format!(); // } -fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { +fn path_expr(p: &mut Parser<'_>, r: Restrictions) -> (CompletedMarker, BlockLike) { assert!(paths::is_path_start(p)); let m = p.start(); paths::expr_path(p); @@ -565,7 +565,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { // S { x, y: 32, ..Default::default() }; // TupleStruct { 0: 1 }; // } -pub(crate) fn record_expr_field_list(p: &mut Parser) { +pub(crate) fn record_expr_field_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 10e5d897e07..30aadb1f9d6 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -24,7 +24,7 @@ pub(crate) const LITERAL_FIRST: TokenSet = TokenSet::new(&[ BYTE_STRING, ]); -pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> { +pub(crate) fn literal(p: &mut Parser<'_>) -> Option<CompletedMarker> { if !p.at_ts(LITERAL_FIRST) { return None; } @@ -60,7 +60,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[T![let]]); -pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { +pub(super) fn atom_expr(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { if let Some(m) = literal(p) { return Some((m, BlockLike::NotBlock)); } @@ -169,7 +169,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar // (1); // (1,); // } -fn tuple_expr(p: &mut Parser) -> CompletedMarker { +fn tuple_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T!['('])); let m = p.start(); p.expect(T!['(']); @@ -201,7 +201,7 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { // [1, 2,]; // [1; 2]; // } -fn array_expr(p: &mut Parser) -> CompletedMarker { +fn array_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T!['['])); let m = p.start(); @@ -248,7 +248,7 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { // for<'a> || {}; // for<'a> move || {}; // } -fn closure_expr(p: &mut Parser) -> CompletedMarker { +fn closure_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(match p.current() { T![static] | T![async] | T![move] | T![|] => true, T![for] => p.nth(1) == T![<], @@ -290,7 +290,7 @@ fn closure_expr(p: &mut Parser) -> CompletedMarker { // if S {}; // if { true } { } else { }; // } -fn if_expr(p: &mut Parser) -> CompletedMarker { +fn if_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![if])); let m = p.start(); p.bump(T![if]); @@ -313,7 +313,7 @@ fn if_expr(p: &mut Parser) -> CompletedMarker { // 'b: while true {} // 'c: for x in () {} // } -fn label(p: &mut Parser) { +fn label(p: &mut Parser<'_>) { assert!(p.at(LIFETIME_IDENT) && p.nth(1) == T![:]); let m = p.start(); lifetime(p); @@ -325,7 +325,7 @@ fn label(p: &mut Parser) { // fn foo() { // loop {}; // } -fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { +fn loop_expr(p: &mut Parser<'_>, m: Option<Marker>) -> CompletedMarker { assert!(p.at(T![loop])); let m = m.unwrap_or_else(|| p.start()); p.bump(T![loop]); @@ -339,7 +339,7 @@ fn loop_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { // while let Some(x) = it.next() {}; // while { true } {}; // } -fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { +fn while_expr(p: &mut Parser<'_>, m: Option<Marker>) -> CompletedMarker { assert!(p.at(T![while])); let m = m.unwrap_or_else(|| p.start()); p.bump(T![while]); @@ -352,7 +352,7 @@ fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { // fn foo() { // for x in [] {}; // } -fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { +fn for_expr(p: &mut Parser<'_>, m: Option<Marker>) -> CompletedMarker { assert!(p.at(T![for])); let m = m.unwrap_or_else(|| p.start()); p.bump(T![for]); @@ -368,7 +368,7 @@ fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { // if let Some(_) = None && true {} // while 1 == 5 && (let None = None) {} // } -fn let_expr(p: &mut Parser) -> CompletedMarker { +fn let_expr(p: &mut Parser<'_>) -> CompletedMarker { let m = p.start(); p.bump(T![let]); patterns::pattern_top(p); @@ -384,7 +384,7 @@ fn let_expr(p: &mut Parser) -> CompletedMarker { // match { } { _ => () }; // match { S {} } {}; // } -fn match_expr(p: &mut Parser) -> CompletedMarker { +fn match_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![match])); let m = p.start(); p.bump(T![match]); @@ -397,7 +397,7 @@ fn match_expr(p: &mut Parser) -> CompletedMarker { m.complete(p, MATCH_EXPR) } -pub(crate) fn match_arm_list(p: &mut Parser) { +pub(crate) fn match_arm_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.eat(T!['{']); @@ -434,7 +434,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { // | X => (), // }; // } -fn match_arm(p: &mut Parser) { +fn match_arm(p: &mut Parser<'_>) { let m = p.start(); // test match_arms_outer_attributes // fn foo() { @@ -482,7 +482,7 @@ fn match_arm(p: &mut Parser) { // _ if let foo = bar => (), // } // } -fn match_guard(p: &mut Parser) -> CompletedMarker { +fn match_guard(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![if])); let m = p.start(); p.bump(T![if]); @@ -495,7 +495,7 @@ fn match_guard(p: &mut Parser) -> CompletedMarker { // fn b() { let _ = 1; } // fn c() { 1; 2; } // fn d() { 1; 2 } -pub(crate) fn block_expr(p: &mut Parser) { +pub(crate) fn block_expr(p: &mut Parser<'_>) { if !p.at(T!['{']) { p.error("expected a block"); return; @@ -505,7 +505,7 @@ pub(crate) fn block_expr(p: &mut Parser) { m.complete(p, BLOCK_EXPR); } -fn stmt_list(p: &mut Parser) -> CompletedMarker { +fn stmt_list(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); @@ -519,7 +519,7 @@ fn stmt_list(p: &mut Parser) -> CompletedMarker { // return; // return 92; // } -fn return_expr(p: &mut Parser) -> CompletedMarker { +fn return_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![return])); let m = p.start(); p.bump(T![return]); @@ -533,7 +533,7 @@ fn return_expr(p: &mut Parser) -> CompletedMarker { // yield; // yield 1; // } -fn yield_expr(p: &mut Parser) -> CompletedMarker { +fn yield_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![yield])); let m = p.start(); p.bump(T![yield]); @@ -550,7 +550,7 @@ fn yield_expr(p: &mut Parser) -> CompletedMarker { // continue 'l; // } // } -fn continue_expr(p: &mut Parser) -> CompletedMarker { +fn continue_expr(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![continue])); let m = p.start(); p.bump(T![continue]); @@ -569,7 +569,7 @@ fn continue_expr(p: &mut Parser) -> CompletedMarker { // break 'l 92; // } // } -fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { +fn break_expr(p: &mut Parser<'_>, r: Restrictions) -> CompletedMarker { assert!(p.at(T![break])); let m = p.start(); p.bump(T![break]); @@ -593,7 +593,7 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker { // fn foo() { // let _ = try {}; // } -fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { +fn try_block_expr(p: &mut Parser<'_>, m: Option<Marker>) -> CompletedMarker { assert!(p.at(T![try])); let m = m.unwrap_or_else(|| p.start()); // Special-case `try!` as macro. @@ -629,7 +629,7 @@ fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { // let y = (box 1i32, box 2i32); // let z = Foo(box 1i32, box 2i32); // } -fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { +fn box_expr(p: &mut Parser<'_>, m: Option<Marker>) -> CompletedMarker { assert!(p.at(T![box])); let m = m.unwrap_or_else(|| p.start()); p.bump(T![box]); diff --git a/crates/parser/src/grammar/generic_args.rs b/crates/parser/src/grammar/generic_args.rs index 862d3b259fe..c438943a002 100644 --- a/crates/parser/src/grammar/generic_args.rs +++ b/crates/parser/src/grammar/generic_args.rs @@ -1,6 +1,6 @@ use super::*; -pub(super) fn opt_generic_arg_list(p: &mut Parser, colon_colon_required: bool) { +pub(super) fn opt_generic_arg_list(p: &mut Parser<'_>, colon_colon_required: bool) { let m; if p.at(T![::]) && p.nth(2) == T![<] { m = p.start(); @@ -25,7 +25,7 @@ pub(super) fn opt_generic_arg_list(p: &mut Parser, colon_colon_required: bool) { // test generic_arg // type T = S<i32>; -fn generic_arg(p: &mut Parser) { +fn generic_arg(p: &mut Parser<'_>) { match p.current() { LIFETIME_IDENT => lifetime_arg(p), T!['{'] | T![true] | T![false] | T![-] => const_arg(p), @@ -74,13 +74,13 @@ fn generic_arg(p: &mut Parser) { // test lifetime_arg // type T = S<'static>; -fn lifetime_arg(p: &mut Parser) { +fn lifetime_arg(p: &mut Parser<'_>) { let m = p.start(); lifetime(p); m.complete(p, LIFETIME_ARG); } -pub(super) fn const_arg_expr(p: &mut Parser) { +pub(super) fn const_arg_expr(p: &mut Parser<'_>) { // The tests in here are really for `const_arg`, which wraps the content // CONST_ARG. match p.current() { @@ -118,13 +118,13 @@ pub(super) fn const_arg_expr(p: &mut Parser) { // test const_arg // type T = S<92>; -pub(super) fn const_arg(p: &mut Parser) { +pub(super) fn const_arg(p: &mut Parser<'_>) { let m = p.start(); const_arg_expr(p); m.complete(p, CONST_ARG); } -fn type_arg(p: &mut Parser) { +fn type_arg(p: &mut Parser<'_>) { let m = p.start(); types::type_(p); m.complete(p, TYPE_ARG); diff --git a/crates/parser/src/grammar/generic_params.rs b/crates/parser/src/grammar/generic_params.rs index 78a75fad1cb..6db28ef1323 100644 --- a/crates/parser/src/grammar/generic_params.rs +++ b/crates/parser/src/grammar/generic_params.rs @@ -1,6 +1,6 @@ use super::*; -pub(super) fn opt_generic_param_list(p: &mut Parser) { +pub(super) fn opt_generic_param_list(p: &mut Parser<'_>) { if p.at(T![<]) { generic_param_list(p); } @@ -8,7 +8,7 @@ pub(super) fn opt_generic_param_list(p: &mut Parser) { // test generic_param_list // fn f<T: Clone>() {} -fn generic_param_list(p: &mut Parser) { +fn generic_param_list(p: &mut Parser<'_>) { assert!(p.at(T![<])); let m = p.start(); p.bump(T![<]); @@ -23,7 +23,7 @@ fn generic_param_list(p: &mut Parser) { m.complete(p, GENERIC_PARAM_LIST); } -fn generic_param(p: &mut Parser) { +fn generic_param(p: &mut Parser<'_>) { let m = p.start(); // test generic_param_attribute // fn foo<#[lt_attr] 'a, #[t_attr] T>() {} @@ -41,7 +41,7 @@ fn generic_param(p: &mut Parser) { // test lifetime_param // fn f<'a: 'b>() {} -fn lifetime_param(p: &mut Parser, m: Marker) { +fn lifetime_param(p: &mut Parser<'_>, m: Marker) { assert!(p.at(LIFETIME_IDENT)); lifetime(p); if p.at(T![:]) { @@ -52,7 +52,7 @@ fn lifetime_param(p: &mut Parser, m: Marker) { // test type_param // fn f<T: Clone>() {} -fn type_param(p: &mut Parser, m: Marker) { +fn type_param(p: &mut Parser<'_>, m: Marker) { assert!(p.at(IDENT)); name(p); if p.at(T![:]) { @@ -69,7 +69,7 @@ fn type_param(p: &mut Parser, m: Marker) { // test const_param // struct S<const N: u32>; -fn const_param(p: &mut Parser, m: Marker) { +fn const_param(p: &mut Parser<'_>, m: Marker) { p.bump(T![const]); name(p); if p.at(T![:]) { @@ -94,7 +94,7 @@ fn const_param(p: &mut Parser, m: Marker) { m.complete(p, CONST_PARAM); } -fn lifetime_bounds(p: &mut Parser) { +fn lifetime_bounds(p: &mut Parser<'_>) { assert!(p.at(T![:])); p.bump(T![:]); while p.at(LIFETIME_IDENT) { @@ -107,18 +107,18 @@ fn lifetime_bounds(p: &mut Parser) { // test type_param_bounds // struct S<T: 'a + ?Sized + (Copy) + ~const Drop>; -pub(super) fn bounds(p: &mut Parser) { +pub(super) fn bounds(p: &mut Parser<'_>) { assert!(p.at(T![:])); p.bump(T![:]); bounds_without_colon(p); } -pub(super) fn bounds_without_colon(p: &mut Parser) { +pub(super) fn bounds_without_colon(p: &mut Parser<'_>) { let m = p.start(); bounds_without_colon_m(p, m); } -pub(super) fn bounds_without_colon_m(p: &mut Parser, marker: Marker) -> CompletedMarker { +pub(super) fn bounds_without_colon_m(p: &mut Parser<'_>, marker: Marker) -> CompletedMarker { while type_bound(p) { if !p.eat(T![+]) { break; @@ -127,7 +127,7 @@ pub(super) fn bounds_without_colon_m(p: &mut Parser, marker: Marker) -> Complete marker.complete(p, TYPE_BOUND_LIST) } -fn type_bound(p: &mut Parser) -> bool { +fn type_bound(p: &mut Parser<'_>) -> bool { let m = p.start(); let has_paren = p.eat(T!['(']); match p.current() { @@ -172,7 +172,7 @@ fn type_bound(p: &mut Parser) -> bool { // Iterator::Item: 'a, // <T as Iterator>::Item: 'a // {} -pub(super) fn opt_where_clause(p: &mut Parser) { +pub(super) fn opt_where_clause(p: &mut Parser<'_>) { if !p.at(T![where]) { return; } @@ -196,7 +196,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) { m.complete(p, WHERE_CLAUSE); - fn is_where_predicate(p: &mut Parser) -> bool { + fn is_where_predicate(p: &mut Parser<'_>) -> bool { match p.current() { LIFETIME_IDENT => true, T![impl] => false, @@ -205,7 +205,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) { } } -fn where_predicate(p: &mut Parser) { +fn where_predicate(p: &mut Parser<'_>) { let m = p.start(); match p.current() { LIFETIME_IDENT => { diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs index 7bfd9ef8c8a..5e0951bf8b5 100644 --- a/crates/parser/src/grammar/items.rs +++ b/crates/parser/src/grammar/items.rs @@ -17,7 +17,7 @@ use super::*; // foo::bar!(); // super::baz! {} // struct S; -pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { +pub(super) fn mod_contents(p: &mut Parser<'_>, stop_on_r_curly: bool) { attributes::inner_attrs(p); while !p.at(EOF) && !(p.at(T!['}']) && stop_on_r_curly) { item_or_macro(p, stop_on_r_curly); @@ -41,7 +41,7 @@ pub(super) const ITEM_RECOVERY_SET: TokenSet = TokenSet::new(&[ T![;], ]); -pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) { +pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool) { let m = p.start(); attributes::outer_attrs(p); @@ -84,7 +84,7 @@ pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) { } /// Try to parse an item, completing `m` in case of success. -pub(super) fn opt_item(p: &mut Parser, m: Marker) -> Result<(), Marker> { +pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> { // test_err pub_expr // fn foo() { pub 92; } let has_visibility = opt_visibility(p, false); @@ -214,7 +214,7 @@ pub(super) fn opt_item(p: &mut Parser, m: Marker) -> Result<(), Marker> { Ok(()) } -fn opt_item_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> { +fn opt_item_without_modifiers(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> { let la = p.nth(1); match p.current() { T![extern] if la == T![crate] => extern_crate(p, m), @@ -239,7 +239,7 @@ fn opt_item_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> { // test extern_crate // extern crate foo; -fn extern_crate(p: &mut Parser, m: Marker) { +fn extern_crate(p: &mut Parser<'_>, m: Marker) { p.bump(T![extern]); p.bump(T![crate]); @@ -262,7 +262,7 @@ fn extern_crate(p: &mut Parser, m: Marker) { // test mod_item // mod a; -pub(crate) fn mod_item(p: &mut Parser, m: Marker) { +pub(crate) fn mod_item(p: &mut Parser<'_>, m: Marker) { p.bump(T![mod]); name(p); if p.at(T!['{']) { @@ -277,7 +277,7 @@ pub(crate) fn mod_item(p: &mut Parser, m: Marker) { // test type_alias // type Foo = Bar; -fn type_alias(p: &mut Parser, m: Marker) { +fn type_alias(p: &mut Parser<'_>, m: Marker) { p.bump(T![type]); name(p); @@ -305,7 +305,7 @@ fn type_alias(p: &mut Parser, m: Marker) { m.complete(p, TYPE_ALIAS); } -pub(crate) fn item_list(p: &mut Parser) { +pub(crate) fn item_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); @@ -314,7 +314,7 @@ pub(crate) fn item_list(p: &mut Parser) { m.complete(p, ITEM_LIST); } -pub(crate) fn extern_item_list(p: &mut Parser) { +pub(crate) fn extern_item_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); @@ -323,7 +323,7 @@ pub(crate) fn extern_item_list(p: &mut Parser) { m.complete(p, EXTERN_ITEM_LIST); } -fn macro_rules(p: &mut Parser, m: Marker) { +fn macro_rules(p: &mut Parser<'_>, m: Marker) { assert!(p.at_contextual_kw(T![macro_rules])); p.bump_remap(T![macro_rules]); p.expect(T![!]); @@ -358,7 +358,7 @@ fn macro_rules(p: &mut Parser, m: Marker) { // test macro_def // macro m($i:ident) {} -fn macro_def(p: &mut Parser, m: Marker) { +fn macro_def(p: &mut Parser<'_>, m: Marker) { p.expect(T![macro]); name_r(p, ITEM_RECOVERY_SET); if p.at(T!['{']) { @@ -382,7 +382,7 @@ fn macro_def(p: &mut Parser, m: Marker) { // test fn // fn foo() {} -fn fn_(p: &mut Parser, m: Marker) { +fn fn_(p: &mut Parser<'_>, m: Marker) { p.bump(T![fn]); name_r(p, ITEM_RECOVERY_SET); @@ -414,13 +414,13 @@ fn fn_(p: &mut Parser, m: Marker) { m.complete(p, FN); } -fn macro_call(p: &mut Parser) -> BlockLike { +fn macro_call(p: &mut Parser<'_>) -> BlockLike { assert!(paths::is_use_path_start(p)); paths::use_path(p); macro_call_after_excl(p) } -pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike { +pub(super) fn macro_call_after_excl(p: &mut Parser<'_>) -> BlockLike { p.expect(T![!]); match p.current() { @@ -439,7 +439,7 @@ pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike { } } -pub(crate) fn token_tree(p: &mut Parser) { +pub(crate) fn token_tree(p: &mut Parser<'_>) { let closing_paren_kind = match p.current() { T!['{'] => T!['}'], T!['('] => T![')'], diff --git a/crates/parser/src/grammar/items/adt.rs b/crates/parser/src/grammar/items/adt.rs index 83b7ff05786..e7d30516b95 100644 --- a/crates/parser/src/grammar/items/adt.rs +++ b/crates/parser/src/grammar/items/adt.rs @@ -2,20 +2,20 @@ use super::*; // test struct_item // struct S {} -pub(super) fn strukt(p: &mut Parser, m: Marker) { +pub(super) fn strukt(p: &mut Parser<'_>, m: Marker) { p.bump(T![struct]); struct_or_union(p, m, true); } // test union_item // struct U { i: i32, f: f32 } -pub(super) fn union(p: &mut Parser, m: Marker) { +pub(super) fn union(p: &mut Parser<'_>, m: Marker) { assert!(p.at_contextual_kw(T![union])); p.bump_remap(T![union]); struct_or_union(p, m, false); } -fn struct_or_union(p: &mut Parser, m: Marker, is_struct: bool) { +fn struct_or_union(p: &mut Parser<'_>, m: Marker, is_struct: bool) { name_r(p, ITEM_RECOVERY_SET); generic_params::opt_generic_param_list(p); match p.current() { @@ -50,7 +50,7 @@ fn struct_or_union(p: &mut Parser, m: Marker, is_struct: bool) { m.complete(p, if is_struct { STRUCT } else { UNION }); } -pub(super) fn enum_(p: &mut Parser, m: Marker) { +pub(super) fn enum_(p: &mut Parser<'_>, m: Marker) { p.bump(T![enum]); name_r(p, ITEM_RECOVERY_SET); generic_params::opt_generic_param_list(p); @@ -63,7 +63,7 @@ pub(super) fn enum_(p: &mut Parser, m: Marker) { m.complete(p, ENUM); } -pub(crate) fn variant_list(p: &mut Parser) { +pub(crate) fn variant_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); @@ -80,7 +80,7 @@ pub(crate) fn variant_list(p: &mut Parser) { p.expect(T!['}']); m.complete(p, VARIANT_LIST); - fn variant(p: &mut Parser) { + fn variant(p: &mut Parser<'_>) { let m = p.start(); attributes::outer_attrs(p); if p.at(IDENT) { @@ -106,7 +106,7 @@ pub(crate) fn variant_list(p: &mut Parser) { // test record_field_list // struct S { a: i32, b: f32 } -pub(crate) fn record_field_list(p: &mut Parser) { +pub(crate) fn record_field_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); @@ -123,7 +123,7 @@ pub(crate) fn record_field_list(p: &mut Parser) { p.expect(T!['}']); m.complete(p, RECORD_FIELD_LIST); - fn record_field(p: &mut Parser) { + fn record_field(p: &mut Parser<'_>) { let m = p.start(); // test record_field_attrs // struct S { #[attr] f: f32 } @@ -141,7 +141,7 @@ pub(crate) fn record_field_list(p: &mut Parser) { } } -fn tuple_field_list(p: &mut Parser) { +fn tuple_field_list(p: &mut Parser<'_>) { assert!(p.at(T!['('])); let m = p.start(); p.bump(T!['(']); diff --git a/crates/parser/src/grammar/items/consts.rs b/crates/parser/src/grammar/items/consts.rs index 98064cd98ad..9549ec9b400 100644 --- a/crates/parser/src/grammar/items/consts.rs +++ b/crates/parser/src/grammar/items/consts.rs @@ -2,17 +2,17 @@ use super::*; // test const_item // const C: u32 = 92; -pub(super) fn konst(p: &mut Parser, m: Marker) { +pub(super) fn konst(p: &mut Parser<'_>, m: Marker) { p.bump(T![const]); const_or_static(p, m, true); } -pub(super) fn static_(p: &mut Parser, m: Marker) { +pub(super) fn static_(p: &mut Parser<'_>, m: Marker) { p.bump(T![static]); const_or_static(p, m, false); } -fn const_or_static(p: &mut Parser, m: Marker, is_const: bool) { +fn const_or_static(p: &mut Parser<'_>, m: Marker, is_const: bool) { p.eat(T![mut]); if is_const && p.eat(T![_]) { diff --git a/crates/parser/src/grammar/items/traits.rs b/crates/parser/src/grammar/items/traits.rs index d6bb3b9b621..c982e2d564c 100644 --- a/crates/parser/src/grammar/items/traits.rs +++ b/crates/parser/src/grammar/items/traits.rs @@ -2,7 +2,7 @@ use super::*; // test trait_item // trait T { fn new() -> Self; } -pub(super) fn trait_(p: &mut Parser, m: Marker) { +pub(super) fn trait_(p: &mut Parser<'_>, m: Marker) { p.bump(T![trait]); name_r(p, ITEM_RECOVERY_SET); @@ -44,7 +44,7 @@ pub(super) fn trait_(p: &mut Parser, m: Marker) { // test impl_item // impl S {} -pub(super) fn impl_(p: &mut Parser, m: Marker) { +pub(super) fn impl_(p: &mut Parser<'_>, m: Marker) { p.bump(T![impl]); if p.at(T![<]) && not_a_qualified_path(p) { generic_params::opt_generic_param_list(p); @@ -80,7 +80,7 @@ pub(super) fn impl_(p: &mut Parser, m: Marker) { // fn foo() {} // fn bar(&self) {} // } -pub(crate) fn assoc_item_list(p: &mut Parser) { +pub(crate) fn assoc_item_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); @@ -102,7 +102,7 @@ pub(crate) fn assoc_item_list(p: &mut Parser) { // test impl_type_params // impl<const N: u32> Bar<N> {} -fn not_a_qualified_path(p: &Parser) -> bool { +fn not_a_qualified_path(p: &Parser<'_>) -> bool { // There's an ambiguity between generic parameters and qualified paths in impls. // If we see `<` it may start both, so we have to inspect some following tokens. // The following combinations can only start generics, @@ -131,7 +131,7 @@ fn not_a_qualified_path(p: &Parser) -> bool { // impl Trait1 for T {} // impl impl NotType {} // impl Trait2 for impl NotType {} -pub(crate) fn impl_type(p: &mut Parser) { +pub(crate) fn impl_type(p: &mut Parser<'_>) { if p.at(T![impl]) { p.error("expected trait or type"); return; diff --git a/crates/parser/src/grammar/items/use_item.rs b/crates/parser/src/grammar/items/use_item.rs index ffb147b1fd2..69880b7946b 100644 --- a/crates/parser/src/grammar/items/use_item.rs +++ b/crates/parser/src/grammar/items/use_item.rs @@ -2,7 +2,7 @@ use super::*; // test use_item // use std::collections; -pub(super) fn use_(p: &mut Parser, m: Marker) { +pub(super) fn use_(p: &mut Parser<'_>, m: Marker) { p.bump(T![use]); use_tree(p, true); p.expect(T![;]); @@ -11,7 +11,7 @@ pub(super) fn use_(p: &mut Parser, m: Marker) { // test use_tree // use outer::tree::{inner::tree}; -fn use_tree(p: &mut Parser, top_level: bool) { +fn use_tree(p: &mut Parser<'_>, top_level: bool) { let m = p.start(); match p.current() { // test use_tree_star @@ -78,7 +78,7 @@ fn use_tree(p: &mut Parser, top_level: bool) { // test use_tree_list // use {a, b, c}; -pub(crate) fn use_tree_list(p: &mut Parser) { +pub(crate) fn use_tree_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); diff --git a/crates/parser/src/grammar/params.rs b/crates/parser/src/grammar/params.rs index c2e633fdb0b..20e8e95f066 100644 --- a/crates/parser/src/grammar/params.rs +++ b/crates/parser/src/grammar/params.rs @@ -5,21 +5,21 @@ use super::*; // fn b(x: i32) {} // fn c(x: i32, ) {} // fn d(x: i32, y: ()) {} -pub(super) fn param_list_fn_def(p: &mut Parser) { +pub(super) fn param_list_fn_def(p: &mut Parser<'_>) { list_(p, Flavor::FnDef); } // test param_list_opt_patterns // fn foo<F: FnMut(&mut Foo<'a>)>(){} -pub(super) fn param_list_fn_trait(p: &mut Parser) { +pub(super) fn param_list_fn_trait(p: &mut Parser<'_>) { list_(p, Flavor::FnTrait); } -pub(super) fn param_list_fn_ptr(p: &mut Parser) { +pub(super) fn param_list_fn_ptr(p: &mut Parser<'_>) { list_(p, Flavor::FnPointer); } -pub(super) fn param_list_closure(p: &mut Parser) { +pub(super) fn param_list_closure(p: &mut Parser<'_>) { list_(p, Flavor::Closure); } @@ -31,7 +31,7 @@ enum Flavor { Closure, } -fn list_(p: &mut Parser, flavor: Flavor) { +fn list_(p: &mut Parser<'_>, flavor: Flavor) { use Flavor::*; let (bra, ket) = match flavor { @@ -87,7 +87,7 @@ fn list_(p: &mut Parser, flavor: Flavor) { const PARAM_FIRST: TokenSet = patterns::PATTERN_FIRST.union(types::TYPE_FIRST); -fn param(p: &mut Parser, m: Marker, flavor: Flavor) { +fn param(p: &mut Parser<'_>, m: Marker, flavor: Flavor) { match flavor { // test param_list_vararg // extern "C" { fn printf(format: *const i8, ..., _: u8) -> i32; } @@ -146,7 +146,7 @@ fn param(p: &mut Parser, m: Marker, flavor: Flavor) { m.complete(p, PARAM); } -fn variadic_param(p: &mut Parser) -> bool { +fn variadic_param(p: &mut Parser<'_>) -> bool { if p.at(T![:]) && p.nth_at(1, T![...]) { p.bump(T![:]); p.bump(T![...]); @@ -164,7 +164,7 @@ fn variadic_param(p: &mut Parser) -> bool { // fn d(&'a mut self, x: i32) {} // fn e(mut self) {} // } -fn opt_self_param(p: &mut Parser, m: Marker) -> Result<(), Marker> { +fn opt_self_param(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> { if p.at(T![self]) || p.at(T![mut]) && p.nth(1) == T![self] { p.eat(T![mut]); self_as_name(p); @@ -202,7 +202,7 @@ fn opt_self_param(p: &mut Parser, m: Marker) -> Result<(), Marker> { Ok(()) } -fn self_as_name(p: &mut Parser) { +fn self_as_name(p: &mut Parser<'_>) { let m = p.start(); p.bump(T![self]); m.complete(p, NAME); diff --git a/crates/parser/src/grammar/paths.rs b/crates/parser/src/grammar/paths.rs index b4a60574e51..22c7f003f41 100644 --- a/crates/parser/src/grammar/paths.rs +++ b/crates/parser/src/grammar/paths.rs @@ -3,11 +3,11 @@ use super::*; pub(super) const PATH_FIRST: TokenSet = TokenSet::new(&[IDENT, T![self], T![super], T![crate], T![Self], T![:], T![<]]); -pub(super) fn is_path_start(p: &Parser) -> bool { +pub(super) fn is_path_start(p: &Parser<'_>) -> bool { is_use_path_start(p) || p.at(T![<]) || p.at(T![Self]) } -pub(super) fn is_use_path_start(p: &Parser) -> bool { +pub(super) fn is_use_path_start(p: &Parser<'_>) -> bool { match p.current() { IDENT | T![self] | T![super] | T![crate] => true, T![:] if p.at(T![::]) => true, @@ -15,19 +15,19 @@ pub(super) fn is_use_path_start(p: &Parser) -> bool { } } -pub(super) fn use_path(p: &mut Parser) { +pub(super) fn use_path(p: &mut Parser<'_>) { path(p, Mode::Use); } -pub(crate) fn type_path(p: &mut Parser) { +pub(crate) fn type_path(p: &mut Parser<'_>) { path(p, Mode::Type); } -pub(super) fn expr_path(p: &mut Parser) { +pub(super) fn expr_path(p: &mut Parser<'_>) { path(p, Mode::Expr); } -pub(crate) fn type_path_for_qualifier(p: &mut Parser, qual: CompletedMarker) -> CompletedMarker { +pub(crate) fn type_path_for_qualifier(p: &mut Parser<'_>, qual: CompletedMarker) -> CompletedMarker { path_for_qualifier(p, Mode::Type, qual) } @@ -38,14 +38,14 @@ enum Mode { Expr, } -fn path(p: &mut Parser, mode: Mode) { +fn path(p: &mut Parser<'_>, mode: Mode) { let path = p.start(); path_segment(p, mode, true); let qual = path.complete(p, PATH); path_for_qualifier(p, mode, qual); } -fn path_for_qualifier(p: &mut Parser, mode: Mode, mut qual: CompletedMarker) -> CompletedMarker { +fn path_for_qualifier(p: &mut Parser<'_>, mode: Mode, mut qual: CompletedMarker) -> CompletedMarker { loop { let use_tree = matches!(p.nth(2), T![*] | T!['{']); if p.at(T![::]) && !use_tree { @@ -60,7 +60,7 @@ fn path_for_qualifier(p: &mut Parser, mode: Mode, mut qual: CompletedMarker) -> } } -fn path_segment(p: &mut Parser, mode: Mode, first: bool) { +fn path_segment(p: &mut Parser<'_>, mode: Mode, first: bool) { let m = p.start(); // test qual_paths // type X = <A as B>::Output; @@ -107,7 +107,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { m.complete(p, PATH_SEGMENT); } -fn opt_path_type_args(p: &mut Parser, mode: Mode) { +fn opt_path_type_args(p: &mut Parser<'_>, mode: Mode) { match mode { Mode::Use => {} Mode::Type => { diff --git a/crates/parser/src/grammar/patterns.rs b/crates/parser/src/grammar/patterns.rs index 1f622b32e5b..4cbf1030614 100644 --- a/crates/parser/src/grammar/patterns.rs +++ b/crates/parser/src/grammar/patterns.rs @@ -13,22 +13,22 @@ pub(super) const PATTERN_FIRST: TokenSet = T![.], ])); -pub(crate) fn pattern(p: &mut Parser) { +pub(crate) fn pattern(p: &mut Parser<'_>) { pattern_r(p, PAT_RECOVERY_SET); } /// Parses a pattern list separated by pipes `|`. -pub(super) fn pattern_top(p: &mut Parser) { +pub(super) fn pattern_top(p: &mut Parser<'_>) { pattern_top_r(p, PAT_RECOVERY_SET); } -pub(crate) fn pattern_single(p: &mut Parser) { +pub(crate) fn pattern_single(p: &mut Parser<'_>) { pattern_single_r(p, PAT_RECOVERY_SET); } /// Parses a pattern list separated by pipes `|` /// using the given `recovery_set`. -pub(super) fn pattern_top_r(p: &mut Parser, recovery_set: TokenSet) { +pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) { p.eat(T![|]); pattern_r(p, recovery_set); } @@ -45,7 +45,7 @@ pub(super) fn pattern_top_r(p: &mut Parser, recovery_set: TokenSet) { // [_ | _,] => (), // } // } -fn pattern_r(p: &mut Parser, recovery_set: TokenSet) { +fn pattern_r(p: &mut Parser<'_>, recovery_set: TokenSet) { let m = p.start(); pattern_single_r(p, recovery_set); @@ -59,7 +59,7 @@ fn pattern_r(p: &mut Parser, recovery_set: TokenSet) { m.complete(p, OR_PAT); } -fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) { +fn pattern_single_r(p: &mut Parser<'_>, recovery_set: TokenSet) { if let Some(lhs) = atom_pat(p, recovery_set) { // test range_pat // fn main() { @@ -106,7 +106,7 @@ fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) { const PAT_RECOVERY_SET: TokenSet = TokenSet::new(&[T![let], T![if], T![while], T![loop], T![match], T![')'], T![,], T![=]]); -fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> { +fn atom_pat(p: &mut Parser<'_>, recovery_set: TokenSet) -> Option<CompletedMarker> { let m = match p.current() { T![box] => box_pat(p), T![ref] | T![mut] => ident_pat(p, true), @@ -139,7 +139,7 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> { Some(m) } -fn is_literal_pat_start(p: &Parser) -> bool { +fn is_literal_pat_start(p: &Parser<'_>) -> bool { p.at(T![-]) && (p.nth(1) == INT_NUMBER || p.nth(1) == FLOAT_NUMBER) || p.at_ts(expressions::LITERAL_FIRST) } @@ -153,7 +153,7 @@ fn is_literal_pat_start(p: &Parser) -> bool { // "hello" => (), // } // } -fn literal_pat(p: &mut Parser) -> CompletedMarker { +fn literal_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(is_literal_pat_start(p)); let m = p.start(); if p.at(T![-]) { @@ -170,7 +170,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker { // let Bar { .. } = (); // let Bar(..) = (); // } -fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker { +fn path_or_macro_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(paths::is_path_start(p)); let m = p.start(); paths::expr_path(p); @@ -203,7 +203,7 @@ fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker { // let S(_,) = (); // let S(_, .. , x) = (); // } -fn tuple_pat_fields(p: &mut Parser) { +fn tuple_pat_fields(p: &mut Parser<'_>) { assert!(p.at(T!['('])); p.bump(T!['(']); pat_list(p, T![')']); @@ -216,7 +216,7 @@ fn tuple_pat_fields(p: &mut Parser) { // let S { x: 1 } = (); // let S { #[cfg(any())] x: 1 } = (); // } -fn record_pat_field(p: &mut Parser) { +fn record_pat_field(p: &mut Parser<'_>) { match p.current() { IDENT | INT_NUMBER if p.nth(1) == T![:] => { name_ref_or_index(p); @@ -244,7 +244,7 @@ fn record_pat_field(p: &mut Parser) { // let S { h: _, } = (); // let S { #[cfg(any())] .. } = (); // } -fn record_pat_field_list(p: &mut Parser) { +fn record_pat_field_list(p: &mut Parser<'_>) { assert!(p.at(T!['{'])); let m = p.start(); p.bump(T!['{']); @@ -277,7 +277,7 @@ fn record_pat_field_list(p: &mut Parser) { // test placeholder_pat // fn main() { let _ = (); } -fn wildcard_pat(p: &mut Parser) -> CompletedMarker { +fn wildcard_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![_])); let m = p.start(); p.bump(T![_]); @@ -310,7 +310,7 @@ fn wildcard_pat(p: &mut Parser) -> CompletedMarker { // let [head, .., mid, tail @ ..] = (); // let [head, .., mid, .., cons] = (); // } -fn rest_pat(p: &mut Parser) -> CompletedMarker { +fn rest_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![..])); let m = p.start(); p.bump(T![..]); @@ -322,7 +322,7 @@ fn rest_pat(p: &mut Parser) -> CompletedMarker { // let &a = (); // let &mut b = (); // } -fn ref_pat(p: &mut Parser) -> CompletedMarker { +fn ref_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![&])); let m = p.start(); p.bump(T![&]); @@ -338,7 +338,7 @@ fn ref_pat(p: &mut Parser) -> CompletedMarker { // let (..) = (); // let () = (); // } -fn tuple_pat(p: &mut Parser) -> CompletedMarker { +fn tuple_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T!['('])); let m = p.start(); p.bump(T!['(']); @@ -368,7 +368,7 @@ fn tuple_pat(p: &mut Parser) -> CompletedMarker { // fn main() { // let [a, b, ..] = []; // } -fn slice_pat(p: &mut Parser) -> CompletedMarker { +fn slice_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T!['['])); let m = p.start(); p.bump(T!['[']); @@ -377,7 +377,7 @@ fn slice_pat(p: &mut Parser) -> CompletedMarker { m.complete(p, SLICE_PAT) } -fn pat_list(p: &mut Parser, ket: SyntaxKind) { +fn pat_list(p: &mut Parser<'_>, ket: SyntaxKind) { while !p.at(EOF) && !p.at(ket) { if !p.at_ts(PATTERN_FIRST) { p.error("expected a pattern"); @@ -400,7 +400,7 @@ fn pat_list(p: &mut Parser, ket: SyntaxKind) { // let e @ _ = (); // let ref mut f @ g @ _ = (); // } -fn ident_pat(p: &mut Parser, with_at: bool) -> CompletedMarker { +fn ident_pat(p: &mut Parser<'_>, with_at: bool) -> CompletedMarker { assert!(matches!(p.current(), T![ref] | T![mut] | IDENT)); let m = p.start(); p.eat(T![ref]); @@ -418,7 +418,7 @@ fn ident_pat(p: &mut Parser, with_at: bool) -> CompletedMarker { // let box Outer { box i, j: box Inner(box &x) } = (); // let box ref mut i = (); // } -fn box_pat(p: &mut Parser) -> CompletedMarker { +fn box_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![box])); let m = p.start(); p.bump(T![box]); @@ -431,7 +431,7 @@ fn box_pat(p: &mut Parser) -> CompletedMarker { // let const { 15 } = (); // let const { foo(); bar() } = (); // } -fn const_block_pat(p: &mut Parser) -> CompletedMarker { +fn const_block_pat(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(T![const])); let m = p.start(); p.bump(T![const]); diff --git a/crates/parser/src/grammar/types.rs b/crates/parser/src/grammar/types.rs index 46db487d02c..5c6e18fee8b 100644 --- a/crates/parser/src/grammar/types.rs +++ b/crates/parser/src/grammar/types.rs @@ -25,15 +25,15 @@ const TYPE_RECOVERY_SET: TokenSet = TokenSet::new(&[ T![pub], ]); -pub(crate) fn type_(p: &mut Parser) { +pub(crate) fn type_(p: &mut Parser<'_>) { type_with_bounds_cond(p, true); } -pub(super) fn type_no_bounds(p: &mut Parser) { +pub(super) fn type_no_bounds(p: &mut Parser<'_>) { type_with_bounds_cond(p, false); } -fn type_with_bounds_cond(p: &mut Parser, allow_bounds: bool) { +fn type_with_bounds_cond(p: &mut Parser<'_>, allow_bounds: bool) { match p.current() { T!['('] => paren_or_tuple_type(p), T![!] => never_type(p), @@ -54,7 +54,7 @@ fn type_with_bounds_cond(p: &mut Parser, allow_bounds: bool) { } } -pub(super) fn ascription(p: &mut Parser) { +pub(super) fn ascription(p: &mut Parser<'_>) { assert!(p.at(T![:])); p.bump(T![:]); if p.at(T![=]) { @@ -66,7 +66,7 @@ pub(super) fn ascription(p: &mut Parser) { type_(p); } -fn paren_or_tuple_type(p: &mut Parser) { +fn paren_or_tuple_type(p: &mut Parser<'_>) { assert!(p.at(T!['('])); let m = p.start(); p.bump(T!['(']); @@ -101,14 +101,14 @@ fn paren_or_tuple_type(p: &mut Parser) { // test never_type // type Never = !; -fn never_type(p: &mut Parser) { +fn never_type(p: &mut Parser<'_>) { assert!(p.at(T![!])); let m = p.start(); p.bump(T![!]); m.complete(p, NEVER_TYPE); } -fn ptr_type(p: &mut Parser) { +fn ptr_type(p: &mut Parser<'_>) { assert!(p.at(T![*])); let m = p.start(); p.bump(T![*]); @@ -132,7 +132,7 @@ fn ptr_type(p: &mut Parser) { m.complete(p, PTR_TYPE); } -fn array_or_slice_type(p: &mut Parser) { +fn array_or_slice_type(p: &mut Parser<'_>) { assert!(p.at(T!['['])); let m = p.start(); p.bump(T!['[']); @@ -168,7 +168,7 @@ fn array_or_slice_type(p: &mut Parser) { // type A = &(); // type B = &'static (); // type C = &mut (); -fn ref_type(p: &mut Parser) { +fn ref_type(p: &mut Parser<'_>) { assert!(p.at(T![&])); let m = p.start(); p.bump(T![&]); @@ -182,7 +182,7 @@ fn ref_type(p: &mut Parser) { // test placeholder_type // type Placeholder = _; -fn infer_type(p: &mut Parser) { +fn infer_type(p: &mut Parser<'_>) { assert!(p.at(T![_])); let m = p.start(); p.bump(T![_]); @@ -194,7 +194,7 @@ fn infer_type(p: &mut Parser) { // type B = unsafe fn(); // type C = unsafe extern "C" fn(); // type D = extern "C" fn ( u8 , ... ) -> u8; -fn fn_ptr_type(p: &mut Parser) { +fn fn_ptr_type(p: &mut Parser<'_>) { let m = p.start(); p.eat(T![unsafe]); if p.at(T![extern]) { @@ -218,7 +218,7 @@ fn fn_ptr_type(p: &mut Parser) { m.complete(p, FN_PTR_TYPE); } -pub(super) fn for_binder(p: &mut Parser) { +pub(super) fn for_binder(p: &mut Parser<'_>) { assert!(p.at(T![for])); p.bump(T![for]); if p.at(T![<]) { @@ -232,7 +232,7 @@ pub(super) fn for_binder(p: &mut Parser) { // type A = for<'a> fn() -> (); // type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); // type Obj = for<'a> PartialEq<&'a i32>; -pub(super) fn for_type(p: &mut Parser, allow_bounds: bool) { +pub(super) fn for_type(p: &mut Parser<'_>, allow_bounds: bool) { assert!(p.at(T![for])); let m = p.start(); for_binder(p); @@ -256,7 +256,7 @@ pub(super) fn for_type(p: &mut Parser, allow_bounds: bool) { // test impl_trait_type // type A = impl Iterator<Item=Foo<'a>> + 'a; -fn impl_trait_type(p: &mut Parser) { +fn impl_trait_type(p: &mut Parser<'_>) { assert!(p.at(T![impl])); let m = p.start(); p.bump(T![impl]); @@ -266,7 +266,7 @@ fn impl_trait_type(p: &mut Parser) { // test dyn_trait_type // type A = dyn Iterator<Item=Foo<'a>> + 'a; -fn dyn_trait_type(p: &mut Parser) { +fn dyn_trait_type(p: &mut Parser<'_>) { assert!(p.at(T![dyn])); let m = p.start(); p.bump(T![dyn]); @@ -279,14 +279,14 @@ fn dyn_trait_type(p: &mut Parser) { // type B = ::Foo; // type C = self::Foo; // type D = super::Foo; -pub(super) fn path_type(p: &mut Parser) { +pub(super) fn path_type(p: &mut Parser<'_>) { path_type_(p, true); } // test macro_call_type // type A = foo!(); // type B = crate::foo!(); -fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { +fn path_or_macro_type_(p: &mut Parser<'_>, allow_bounds: bool) { assert!(paths::is_path_start(p)); let r = p.start(); let m = p.start(); @@ -309,7 +309,7 @@ fn path_or_macro_type_(p: &mut Parser, allow_bounds: bool) { } } -pub(super) fn path_type_(p: &mut Parser, allow_bounds: bool) { +pub(super) fn path_type_(p: &mut Parser<'_>, allow_bounds: bool) { assert!(paths::is_path_start(p)); let m = p.start(); paths::type_path(p); @@ -325,7 +325,7 @@ pub(super) fn path_type_(p: &mut Parser, allow_bounds: bool) { /// This turns a parsed PATH_TYPE or FOR_TYPE optionally into a DYN_TRAIT_TYPE /// with a TYPE_BOUND_LIST -fn opt_type_bounds_as_dyn_trait_type(p: &mut Parser, type_marker: CompletedMarker) { +fn opt_type_bounds_as_dyn_trait_type(p: &mut Parser<'_>, type_marker: CompletedMarker) { assert!(matches!( type_marker.kind(), SyntaxKind::PATH_TYPE | SyntaxKind::FOR_TYPE | SyntaxKind::MACRO_TYPE diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index 203f59407a2..87be4792773 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -79,7 +79,7 @@ pub enum TopEntryPoint { impl TopEntryPoint { pub fn parse(&self, input: &Input) -> Output { - let entry_point: fn(&'_ mut parser::Parser) = match self { + let entry_point: fn(&'_ mut parser::Parser<'_>) = match self { TopEntryPoint::SourceFile => grammar::entry::top::source_file, TopEntryPoint::MacroStmts => grammar::entry::top::macro_stmts, TopEntryPoint::MacroItems => grammar::entry::top::macro_items, @@ -136,7 +136,7 @@ pub enum PrefixEntryPoint { impl PrefixEntryPoint { pub fn parse(&self, input: &Input) -> Output { - let entry_point: fn(&'_ mut parser::Parser) = match self { + let entry_point: fn(&'_ mut parser::Parser<'_>) = match self { PrefixEntryPoint::Vis => grammar::entry::prefix::vis, PrefixEntryPoint::Block => grammar::entry::prefix::block, PrefixEntryPoint::Stmt => grammar::entry::prefix::stmt, @@ -155,7 +155,7 @@ impl PrefixEntryPoint { } /// A parsing function for a specific braced-block. -pub struct Reparser(fn(&mut parser::Parser)); +pub struct Reparser(fn(&mut parser::Parser<'_>)); impl Reparser { /// If the node is a braced block, return the corresponding `Reparser`. diff --git a/crates/parser/src/parser.rs b/crates/parser/src/parser.rs index d4aecf9b446..48d8350e07e 100644 --- a/crates/parser/src/parser.rs +++ b/crates/parser/src/parser.rs @@ -259,7 +259,7 @@ impl Marker { /// Finishes the syntax tree node and assigns `kind` to it, /// and mark the create a `CompletedMarker` for possible future /// operation like `.precede()` to deal with forward_parent. - pub(crate) fn complete(mut self, p: &mut Parser, kind: SyntaxKind) -> CompletedMarker { + pub(crate) fn complete(mut self, p: &mut Parser<'_>, kind: SyntaxKind) -> CompletedMarker { self.bomb.defuse(); let idx = self.pos as usize; match &mut p.events[idx] { @@ -274,7 +274,7 @@ impl Marker { /// Abandons the syntax tree node. All its children /// are attached to its parent instead. - pub(crate) fn abandon(mut self, p: &mut Parser) { + pub(crate) fn abandon(mut self, p: &mut Parser<'_>) { self.bomb.defuse(); let idx = self.pos as usize; if idx == p.events.len() - 1 { @@ -309,7 +309,7 @@ impl CompletedMarker { /// Append a new `START` events as `[START, FINISH, NEWSTART]`, /// then mark `NEWSTART` as `START`'s parent with saving its relative /// distance to `NEWSTART` into forward_parent(=2 in this case); - pub(crate) fn precede(self, p: &mut Parser) -> Marker { + pub(crate) fn precede(self, p: &mut Parser<'_>) -> Marker { let new_pos = p.start(); let idx = self.pos as usize; match &mut p.events[idx] { @@ -322,7 +322,7 @@ impl CompletedMarker { } /// Extends this completed marker *to the left* up to `m`. - pub(crate) fn extend_to(self, p: &mut Parser, mut m: Marker) -> CompletedMarker { + pub(crate) fn extend_to(self, p: &mut Parser<'_>, mut m: Marker) -> CompletedMarker { m.bomb.defuse(); let idx = m.pos as usize; match &mut p.events[idx] { diff --git a/crates/parser/src/shortcuts.rs b/crates/parser/src/shortcuts.rs index b038d44fe08..4b805faddcb 100644 --- a/crates/parser/src/shortcuts.rs +++ b/crates/parser/src/shortcuts.rs @@ -54,7 +54,7 @@ impl<'a> LexedStr<'a> { pub fn intersperse_trivia( &self, output: &crate::Output, - sink: &mut dyn FnMut(StrStep), + sink: &mut dyn FnMut(StrStep<'_>), ) -> bool { let mut builder = Builder { lexed: self, pos: 0, state: State::PendingEnter, sink }; |
