8392: Add space after lifetime in expand macro r=edwin0cheng a=sharksforarms

When a lifetime is followed by an ident, this lead to invalid syntax. This adds a whitespace between the lifetime and the identifier.

Noticed this here: https://github.com/simrat39/rust-tools.nvim/issues/2#issuecomment-814551847

Co-authored-by: Emmanuel Thompson <eet6646@gmail.com>
This commit is contained in:
bors[bot] 2021-04-07 03:54:28 +00:00 committed by GitHub
commit ad50f5007f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,6 +103,9 @@ fn insert_whitespaces(syn: SyntaxNode) -> String {
format!("\n{}}}", " ".repeat(indent))
}
R_CURLY => format!("}}\n{}", " ".repeat(indent)),
LIFETIME_IDENT if is_next(|it| it == IDENT, true) => {
format!("{} ", token.text().to_string())
}
T![;] => format!(";\n{}", " ".repeat(indent)),
T![->] => " -> ".to_string(),
T![=] => " = ".to_string(),