Skip to content

Commit 17a1011

Browse files
simplify
1 parent d75cacc commit 17a1011

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

crates/ide/src/typing.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,13 @@ fn on_opening_brace_typed(file: &SourceFile, offset: TextSize) -> Option<TextEdi
8585

8686
// We expect a block expression enclosing exactly 1 preexisting expression. It can be parsed as
8787
// either the trailing expr or an ExprStmt.
88-
let offset = {
89-
match block.statements().next() {
90-
Some(ast::Stmt::ExprStmt(it)) => {
91-
// Use the expression span to place `}` before the `;`
92-
it.expr()?.syntax().text_range().end()
93-
}
94-
None => block.tail_expr()?.syntax().text_range().end(),
95-
_ => return None,
88+
let offset = match block.statements().next() {
89+
Some(ast::Stmt::ExprStmt(it)) => {
90+
// Use the expression span to place `}` before the `;`
91+
it.expr()?.syntax().text_range().end()
9692
}
93+
None => block.tail_expr()?.syntax().text_range().end(),
94+
_ => return None,
9795
};
9896

9997
Some(TextEdit::insert(offset, "}".to_string()))

0 commit comments

Comments
 (0)