aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/inline_local_variable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/inline_local_variable.rs')
-rw-r--r--crates/ra_assists/src/inline_local_variable.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_assists/src/inline_local_variable.rs b/crates/ra_assists/src/inline_local_variable.rs
index 950c2910b..e0479ef13 100644
--- a/crates/ra_assists/src/inline_local_variable.rs
+++ b/crates/ra_assists/src/inline_local_variable.rs
@@ -1,7 +1,4 @@
1use hir::{ 1use hir::db::HirDatabase;
2 db::HirDatabase,
3 source_binder::function_from_child_node,
4};
5use ra_syntax::{ 2use ra_syntax::{
6 ast::{self, AstNode, AstToken, PatKind, ExprKind}, 3 ast::{self, AstNode, AstToken, PatKind, ExprKind},
7 TextRange, 4 TextRange,
@@ -29,10 +26,8 @@ pub(crate) fn inline_local_varialbe(mut ctx: AssistCtx<impl HirDatabase>) -> Opt
29 } else { 26 } else {
30 let_stmt.syntax().range() 27 let_stmt.syntax().range()
31 }; 28 };
32 29 let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, bind_pat.syntax(), None);
33 let function = function_from_child_node(ctx.db, ctx.frange.file_id, bind_pat.syntax())?; 30 let refs = analyzer.find_all_refs(bind_pat);
34 let scope = function.scopes(ctx.db);
35 let refs = scope.find_all_refs(bind_pat);
36 31
37 let mut wrap_in_parens = vec![true; refs.len()]; 32 let mut wrap_in_parens = vec![true; refs.len()];
38 33