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
|
@ -527,13 +527,13 @@ impl TokenKind {
|
|||
|
||||
/// Returns tokens that are likely to be typed accidentally instead of the current token.
|
||||
/// Enables better error recovery when the wrong token is found.
|
||||
pub fn similar_tokens(&self) -> Option<Vec<TokenKind>> {
|
||||
match *self {
|
||||
Comma => Some(vec![Dot, Lt, Semi]),
|
||||
Semi => Some(vec![Colon, Comma]),
|
||||
Colon => Some(vec![Semi]),
|
||||
FatArrow => Some(vec![Eq, RArrow, Ge, Gt]),
|
||||
_ => None,
|
||||
pub fn similar_tokens(&self) -> Vec<TokenKind> {
|
||||
match self {
|
||||
Comma => vec![Dot, Lt, Semi],
|
||||
Semi => vec![Colon, Comma],
|
||||
Colon => vec![Semi],
|
||||
FatArrow => vec![Eq, RArrow, Ge, Gt],
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue