mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
ide: insert whitespaces surrounding _
in macro expansion
This commit is contained in:
parent
81805d4cfc
commit
ebf8b1a96e
@ -57,7 +57,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
||||
|f: fn(SyntaxKind) -> bool, default| -> bool { last.map(f).unwrap_or(default) };
|
||||
|
||||
match tok.kind() {
|
||||
k if is_text(k) && is_next(|it| !it.is_punct(), true) => {
|
||||
k if is_text(k) && is_next(|it| !it.is_punct() || it == UNDERSCORE, false) => {
|
||||
mods.push(do_ws(after, tok));
|
||||
}
|
||||
L_CURLY if is_next(|it| it != R_CURLY, true) => {
|
||||
@ -118,5 +118,5 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
||||
}
|
||||
|
||||
fn is_text(k: SyntaxKind) -> bool {
|
||||
k.is_keyword() || k.is_literal() || k == IDENT
|
||||
k.is_keyword() || k.is_literal() || k == IDENT || k == UNDERSCORE
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ fn main() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
foo
|
||||
0 "#]],
|
||||
0"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user