aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/assists/add_explicit_type.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/add_explicit_type.rs b/crates/ra_assists/src/assists/add_explicit_type.rs
index 713abf910..38a351a54 100644
--- a/crates/ra_assists/src/assists/add_explicit_type.rs
+++ b/crates/ra_assists/src/assists/add_explicit_type.rs
@@ -1,7 +1,6 @@
1use hir::{db::HirDatabase, HirDisplay}; 1use hir::{db::HirDatabase, HirDisplay};
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{self, AstNode, LetStmt, NameOwner}, 3 ast::{self, AstNode, LetStmt, NameOwner},
4 SyntaxKind::EQ,
5 TextRange, T, 4 TextRange, T,
6}; 5};
7 6
@@ -37,7 +36,7 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx<impl HirDatabase>) -> Option<Assi
37 let name_range = name.syntax().text_range(); 36 let name_range = name.syntax().text_range();
38 // Assist should only be applicable if cursor is between 'let' and '=' 37 // Assist should only be applicable if cursor is between 'let' and '='
39 let stmt_range = stmt.syntax().text_range(); 38 let stmt_range = stmt.syntax().text_range();
40 let eq_range = stmt.syntax().descendants_with_tokens().find(|t| t.kind() == EQ)?.text_range(); 39 let eq_range = stmt.eq_token()?.text_range();
41 let let_range = TextRange::from_to(stmt_range.start(), eq_range.start()); 40 let let_range = TextRange::from_to(stmt_range.start(), eq_range.start());
42 let cursor_in_range = ctx.frange.range.is_subrange(&let_range); 41 let cursor_in_range = ctx.frange.range.is_subrange(&let_range);
43 if !cursor_in_range { 42 if !cursor_in_range {