diff options
Diffstat (limited to 'crates/ra_ide_api/src/diagnostics.rs')
-rw-r--r-- | crates/ra_ide_api/src/diagnostics.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index e23d178b0..9a0eb2c14 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs | |||
@@ -4,7 +4,7 @@ use itertools::Itertools; | |||
4 | use hir::{source_binder, diagnostics::{Diagnostic as _, DiagnosticSink}}; | 4 | use hir::{source_binder, diagnostics::{Diagnostic as _, DiagnosticSink}}; |
5 | use ra_db::SourceDatabase; | 5 | use ra_db::SourceDatabase; |
6 | use ra_syntax::{ | 6 | use ra_syntax::{ |
7 | Location, SourceFile, SyntaxKind, TextRange, SyntaxNode, | 7 | T, Location, SourceFile, TextRange, SyntaxNode, |
8 | ast::{self, AstNode, NamedFieldList, NamedField}, | 8 | ast::{self, AstNode, NamedFieldList, NamedField}, |
9 | }; | 9 | }; |
10 | use ra_assists::ast_editor::{AstEditor, AstBuilder}; | 10 | use ra_assists::ast_editor::{AstEditor, AstBuilder}; |
@@ -130,9 +130,7 @@ fn text_edit_for_remove_unnecessary_braces_with_self_in_use_statement( | |||
130 | single_use_tree: &ast::UseTree, | 130 | single_use_tree: &ast::UseTree, |
131 | ) -> Option<TextEdit> { | 131 | ) -> Option<TextEdit> { |
132 | let use_tree_list_node = single_use_tree.syntax().parent()?; | 132 | let use_tree_list_node = single_use_tree.syntax().parent()?; |
133 | if single_use_tree.path()?.segment()?.syntax().first_child_or_token()?.kind() | 133 | if single_use_tree.path()?.segment()?.syntax().first_child_or_token()?.kind() == T![self] { |
134 | == SyntaxKind::SELF_KW | ||
135 | { | ||
136 | let start = use_tree_list_node.prev_sibling_or_token()?.range().start(); | 134 | let start = use_tree_list_node.prev_sibling_or_token()?.range().start(); |
137 | let end = use_tree_list_node.range().end(); | 135 | let end = use_tree_list_node.range().end(); |
138 | let range = TextRange::from_to(start, end); | 136 | let range = TextRange::from_to(start, end); |