Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-assists/src/handlers/add_braces.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/add_braces.rs b/crates/ide-assists/src/handlers/add_braces.rs
index 35ee1e5a78..da1322de4b 100644
--- a/crates/ide-assists/src/handlers/add_braces.rs
+++ b/crates/ide-assists/src/handlers/add_braces.rs
@@ -84,6 +84,7 @@ fn get_replacement_node(ctx: &AssistContext<'_>) -> Option<(ParentType, ast::Exp
match parent {
ast::LetStmt(it) => it.initializer()?,
ast::LetExpr(it) => it.expr()?,
+ ast::BinExpr(it) => it.rhs()?,
ast::Static(it) => it.body()?,
ast::Const(it) => it.body()?,
_ => return None,
@@ -194,6 +195,22 @@ fn foo() {
}
"#,
);
+
+ check_assist(
+ add_braces,
+ r#"
+fn foo() {
+ if let x =$0 n + 100 {}
+}
+"#,
+ r#"
+fn foo() {
+ if let x = {
+ n + 100
+ } {}
+}
+"#,
+ );
}
#[test]