We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0946570 + 03ae70d commit 54a1a96Copy full SHA for 54a1a96
src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs
@@ -110,7 +110,8 @@ pub(crate) fn fixup_syntax(
110
}
111
},
112
ast::ExprStmt(it) => {
113
- if it.semicolon_token().is_none() {
+ let needs_semi = it.semicolon_token().is_none() && it.expr().map_or(false, |e| e.syntax().kind() != SyntaxKind::BLOCK_EXPR);
114
+ if needs_semi {
115
append.insert(node.clone().into(), vec![
116
Leaf::Punct(Punct {
117
char: ';',
@@ -905,6 +906,21 @@ fn foo() {
905
906
"#,
907
expect![[r#"
908
fn foo () {|| __ra_fixup}
909
+"#]],
910
+ );
911
+ }
912
+
913
+ #[test]
914
+ fn fixup_regression_() {
915
+ check(
916
+ r#"
917
+fn foo() {
918
+ {}
919
920
+}
921
+"#,
922
+ expect![[r#"
923
+fn foo () {{} {}}
924
"#]],
925
);
926
0 commit comments