diff options
Diffstat (limited to 'crates/assists/src/utils.rs')
-rw-r--r-- | crates/assists/src/utils.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index b05596446..9ea96eb73 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs | |||
@@ -4,7 +4,7 @@ pub(crate) mod import_assets; | |||
4 | use std::ops; | 4 | use std::ops; |
5 | 5 | ||
6 | use hir::HasSource; | 6 | use hir::HasSource; |
7 | use ide_db::RootDatabase; | 7 | use ide_db::{helpers::SnippetCap, RootDatabase}; |
8 | use itertools::Itertools; | 8 | use itertools::Itertools; |
9 | use syntax::{ | 9 | use syntax::{ |
10 | ast::edit::AstNodeEdit, | 10 | ast::edit::AstNodeEdit, |
@@ -16,10 +16,7 @@ use syntax::{ | |||
16 | SyntaxNode, TextSize, T, | 16 | SyntaxNode, TextSize, T, |
17 | }; | 17 | }; |
18 | 18 | ||
19 | use crate::{ | 19 | use crate::ast_transform::{self, AstTransform, QualifyPaths, SubstituteTypeParams}; |
20 | assist_config::SnippetCap, | ||
21 | ast_transform::{self, AstTransform, QualifyPaths, SubstituteTypeParams}, | ||
22 | }; | ||
23 | 20 | ||
24 | pub(crate) fn unwrap_trivial_block(block: ast::BlockExpr) -> ast::Expr { | 21 | pub(crate) fn unwrap_trivial_block(block: ast::BlockExpr) -> ast::Expr { |
25 | extract_trivial_expression(&block) | 22 | extract_trivial_expression(&block) |
@@ -37,7 +34,7 @@ pub fn extract_trivial_expression(block: &ast::BlockExpr) -> Option<ast::Expr> { | |||
37 | non_trivial_children.next().is_some() | 34 | non_trivial_children.next().is_some() |
38 | }; | 35 | }; |
39 | 36 | ||
40 | if let Some(expr) = block.expr() { | 37 | if let Some(expr) = block.tail_expr() { |
41 | if has_anything_else(expr.syntax()) { | 38 | if has_anything_else(expr.syntax()) { |
42 | return None; | 39 | return None; |
43 | } | 40 | } |