Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7c94c29

Browse files
committed
fix: make let_stmts inserted in inline_call correctly indented
1 parent 0a8c784 commit 7c94c29

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/ide-assists/src/handlers/inline_call.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,10 @@ fn inline(
484484
body = make::block_expr(let_stmts, Some(body.into())).clone_for_update();
485485
}
486486
} else if let Some(stmt_list) = body.stmt_list() {
487-
ted::insert_all(
488-
ted::Position::after(
489-
stmt_list.l_curly_token().expect("L_CURLY for StatementList is missing."),
490-
),
491-
let_stmts.into_iter().map(|stmt| stmt.syntax().clone().into()).collect(),
492-
);
487+
let position = stmt_list.l_curly_token().expect("L_CURLY for StatementList is missing.");
488+
let_stmts.into_iter().rev().for_each(|let_stmt| {
489+
ted::insert(ted::Position::after(position.clone()), let_stmt.syntax().clone());
490+
});
493491
}
494492

495493
let original_indentation = match node {

0 commit comments

Comments
 (0)