aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/diagnostics.rs
diff options
context:
space:
mode:
authorSergey Parilin <[email protected]>2019-05-15 13:35:47 +0100
committerSergey Parilin <[email protected]>2019-05-15 13:35:47 +0100
commit993abedd77cf23ce2281b6c8e60cab49ab4fa97e (patch)
treeb8693ce808a9ca2e7eaae5013644a1082fc7bb17 /crates/ra_ide_api/src/diagnostics.rs
parentd77175ce28da45960a89811f273b6c614d7a9413 (diff)
apply T! macro where it is possible
Diffstat (limited to 'crates/ra_ide_api/src/diagnostics.rs')
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs6
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;
4use hir::{source_binder, diagnostics::{Diagnostic as _, DiagnosticSink}}; 4use hir::{source_binder, diagnostics::{Diagnostic as _, DiagnosticSink}};
5use ra_db::SourceDatabase; 5use ra_db::SourceDatabase;
6use ra_syntax::{ 6use 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};
10use ra_assists::ast_editor::{AstEditor, AstBuilder}; 10use 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);