Inline can_begin_literal_maybe_minus
call into two places.
It's clearer this way, because the `Interpolated` cases in `can_begin_const_arg` and `is_pat_range_end_start` are more permissive than the `Interpolated` cases in `can_begin_literal_maybe_minus`.
This commit is contained in:
parent
894f7a4ba6
commit
7d9a92ba31
2 changed files with 5 additions and 3 deletions
|
@ -939,7 +939,8 @@ impl<'a> Parser<'a> {
|
|||
|| self.look_ahead(dist, |t| {
|
||||
t.is_path_start() // e.g. `MY_CONST`;
|
||||
|| t.kind == token::Dot // e.g. `.5` for recovery;
|
||||
|| t.can_begin_literal_maybe_minus() // e.g. `42`.
|
||||
|| matches!(t.kind, token::Literal(..) | token::BinOp(token::Minus))
|
||||
|| t.is_bool_lit()
|
||||
|| t.is_whole_expr()
|
||||
|| t.is_lifetime() // recover `'a` instead of `'a'`
|
||||
|| (self.may_recover() // recover leading `(`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue