simplify similar_tokens from Option<Vec<_>> to Vec<_>
This commit is contained in:
parent
cf577f34c4
commit
ccb967438d
4 changed files with 17 additions and 21 deletions
|
@ -101,15 +101,14 @@ fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a,
|
|||
|
||||
match p.expect(exp!(Comma)) {
|
||||
Err(err) => {
|
||||
match token::TokenKind::Comma.similar_tokens() {
|
||||
Some(tks) if tks.contains(&p.token.kind) => {
|
||||
// If a similar token is found, then it may be a typo. We
|
||||
// consider it as a comma, and continue parsing.
|
||||
err.emit();
|
||||
p.bump();
|
||||
}
|
||||
if token::TokenKind::Comma.similar_tokens().contains(&p.token.kind) {
|
||||
// If a similar token is found, then it may be a typo. We
|
||||
// consider it as a comma, and continue parsing.
|
||||
err.emit();
|
||||
p.bump();
|
||||
} else {
|
||||
// Otherwise stop the parsing and return the error.
|
||||
_ => return Err(err),
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
Ok(Recovered::Yes(_)) => (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue