Apply suggestions

This commit is contained in:
r0cky 2023-08-03 05:18:19 +00:00
parent f5243d2bfc
commit 41e85c3d23

View File

@ -139,7 +139,7 @@ fn parse_pat_allow_top_alt_inner(
};
// Parse the first pattern (`p_0`).
let mut first_pat = self.parse_pat_no_top_alt(expected, syntax_loc.clone())?;
let mut first_pat = self.parse_pat_no_top_alt(expected, syntax_loc)?;
if rc == RecoverComma::Yes {
self.maybe_recover_unexpected_comma(first_pat.span, rt)?;
}
@ -813,7 +813,9 @@ fn can_be_ident_pat(&mut self) -> bool {
| token::DotDotDot | token::DotDotEq | token::DotDot // A range pattern.
| token::ModSep // A tuple / struct variant pattern.
| token::Not)) // A macro expanding to a pattern.
&& !(self.look_ahead(1, |t| t.kind == token::Lt) && self.look_ahead(2, |t| t.can_begin_type())) // May suggest the turbofish syntax for generics, only valid for recoveries.
// May suggest the turbofish syntax for generics, only valid for recoveries.
&& !(self.look_ahead(1, |t| t.kind == token::Lt)
&& self.look_ahead(2, |t| t.can_begin_type()))
}
/// Parses `ident` or `ident @ pat`.