1
Fork 0

Add guard for missing comma in macro call suggestion

This commit is contained in:
Esteban Küber 2019-04-24 16:45:29 -07:00
parent e305df1846
commit 0e505d427a
3 changed files with 27 additions and 9 deletions

View file

@ -182,8 +182,10 @@ impl TokenStream {
(_, (TokenTree::Token(_, token::Token::Comma), _)) => continue,
((TokenTree::Token(sp, token_left), NonJoint),
(TokenTree::Token(_, token_right), _))
if (token_left.is_ident() || token_left.is_lit()) &&
(token_right.is_ident() || token_right.is_lit()) => *sp,
if ((token_left.is_ident() && !token_left.is_reserved_ident())
|| token_left.is_lit()) &&
((token_right.is_ident() && !token_right.is_reserved_ident())
|| token_right.is_lit()) => *sp,
((TokenTree::Delimited(sp, ..), NonJoint), _) => sp.entire(),
_ => continue,
};