diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-07 04:54:28 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-07 04:54:28 +0100 |
commit | ad50f5007f7fe0e02b128a2643cfca2468056f9a (patch) | |
tree | 3c0caf3950f164bbebe1cc5796488d34eb6160a7 /crates/ide/src/expand_macro.rs | |
parent | cf41e1410a0cf87a05b2dd632e3b5d67f8d55327 (diff) | |
parent | 35bec31bca7356d6ae4ef9bfc4f813ebeeb4c971 (diff) |
Merge #8392
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 <[email protected]>
Diffstat (limited to 'crates/ide/src/expand_macro.rs')
-rw-r--r-- | crates/ide/src/expand_macro.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs index 9eeabbeda..d5628e3df 100644 --- a/crates/ide/src/expand_macro.rs +++ b/crates/ide/src/expand_macro.rs | |||
@@ -103,6 +103,9 @@ fn insert_whitespaces(syn: SyntaxNode) -> String { | |||
103 | format!("\n{}}}", " ".repeat(indent)) | 103 | format!("\n{}}}", " ".repeat(indent)) |
104 | } | 104 | } |
105 | R_CURLY => format!("}}\n{}", " ".repeat(indent)), | 105 | R_CURLY => format!("}}\n{}", " ".repeat(indent)), |
106 | LIFETIME_IDENT if is_next(|it| it == IDENT, true) => { | ||
107 | format!("{} ", token.text().to_string()) | ||
108 | } | ||
106 | T![;] => format!(";\n{}", " ".repeat(indent)), | 109 | T![;] => format!(";\n{}", " ".repeat(indent)), |
107 | T![->] => " -> ".to_string(), | 110 | T![->] => " -> ".to_string(), |
108 | T![=] => " = ".to_string(), | 111 | T![=] => " = ".to_string(), |