simplify similar_tokens from Option<Vec<_>> to Vec<_>
This commit is contained in:
@@ -3115,8 +3115,7 @@ impl<'a> Parser<'a> {
|
||||
let arm_body;
|
||||
let is_fat_arrow = this.check(exp!(FatArrow));
|
||||
let is_almost_fat_arrow = TokenKind::FatArrow
|
||||
.similar_tokens()
|
||||
.is_some_and(|similar_tokens| similar_tokens.contains(&this.token.kind));
|
||||
.similar_tokens().contains(&this.token.kind);
|
||||
|
||||
// this avoids the compiler saying that a `,` or `}` was expected even though
|
||||
// the pattern isn't a never pattern (and thus an arm body is required)
|
||||
|
||||
@@ -923,10 +923,8 @@ impl<'a> Parser<'a> {
|
||||
|
||||
_ => {
|
||||
// Attempt to keep parsing if it was a similar separator.
|
||||
if let Some(tokens) = exp.tok.similar_tokens() {
|
||||
if tokens.contains(&self.token.kind) {
|
||||
self.bump();
|
||||
}
|
||||
if exp.tok.similar_tokens().contains(&self.token.kind) {
|
||||
self.bump();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user