Unnamed repository; edit this file 'description' to name the repository.
Open empty braces before else kw
A4-Tacks 3 weeks ago
parent e703847 · commit 1623ab4
-rw-r--r--crates/ide/src/expand_macro.rs4
-rw-r--r--crates/syntax-bridge/src/prettify_macro_expansion.rs8
2 files changed, 11 insertions, 1 deletions
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs
index fe58786991..cc322d2b9e 100644
--- a/crates/ide/src/expand_macro.rs
+++ b/crates/ide/src/expand_macro.rs
@@ -433,7 +433,9 @@ fn main() {
expect![[r#"
match_ast!
{
- if let Some(it) = ast::TraitDef::cast(container.clone()){}else if let Some(it) = ast::ImplDef::cast(container.clone()){}else {
+ if let Some(it) = ast::TraitDef::cast(container.clone()){
+ }else if let Some(it) = ast::ImplDef::cast(container.clone()){
+ }else {
{
continue
}
diff --git a/crates/syntax-bridge/src/prettify_macro_expansion.rs b/crates/syntax-bridge/src/prettify_macro_expansion.rs
index 017aa10b6c..ba1b4f5ae4 100644
--- a/crates/syntax-bridge/src/prettify_macro_expansion.rs
+++ b/crates/syntax-bridge/src/prettify_macro_expansion.rs
@@ -99,6 +99,10 @@ pub fn prettify_macro_expansion(
}
mods.push(do_nl(before, tok));
}
+ R_CURLY if is_next(|it| it == T![else], false) => {
+ mods.push(do_indent(before, tok, indent));
+ mods.push(do_nl(before, tok));
+ }
LIFETIME_IDENT if is_next(is_text, true) => {
mods.push(do_ws(after, tok));
}
@@ -358,6 +362,7 @@ mod tests {
} else if true {
bar()
} else {}
+ if true {} else if true {} else {}
fun()
}
};
@@ -378,6 +383,9 @@ mod tests {
}else if true {
bar()
}else {}
+ if true {
+ }else if true {
+ }else {}
fun()
}
};