aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/Cargo.toml2
-rw-r--r--crates/ra_assists/src/assist_context.rs4
-rw-r--r--crates/ra_assists/src/ast_transform.rs22
-rw-r--r--crates/ra_assists/src/handlers/add_custom_impl.rs2
-rw-r--r--crates/ra_assists/src/handlers/add_explicit_type.rs2
-rw-r--r--crates/ra_assists/src/handlers/add_missing_impl_members.rs2
-rw-r--r--crates/ra_assists/src/handlers/add_turbo_fish.rs2
-rw-r--r--crates/ra_assists/src/handlers/apply_demorgan.rs2
-rw-r--r--crates/ra_assists/src/handlers/auto_import.rs4
-rw-r--r--crates/ra_assists/src/handlers/change_return_type_to_result.rs2
-rw-r--r--crates/ra_assists/src/handlers/change_visibility.rs2
-rw-r--r--crates/ra_assists/src/handlers/early_return.rs2
-rw-r--r--crates/ra_assists/src/handlers/expand_glob_import.rs2
-rw-r--r--crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs4
-rw-r--r--crates/ra_assists/src/handlers/extract_variable.rs4
-rw-r--r--crates/ra_assists/src/handlers/fill_match_arms.rs2
-rw-r--r--crates/ra_assists/src/handlers/fix_visibility.rs2
-rw-r--r--crates/ra_assists/src/handlers/flip_binexpr.rs2
-rw-r--r--crates/ra_assists/src/handlers/flip_comma.rs2
-rw-r--r--crates/ra_assists/src/handlers/flip_trait_bound.rs2
-rw-r--r--crates/ra_assists/src/handlers/generate_derive.rs2
-rw-r--r--crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs2
-rw-r--r--crates/ra_assists/src/handlers/generate_function.rs4
-rw-r--r--crates/ra_assists/src/handlers/generate_impl.rs2
-rw-r--r--crates/ra_assists/src/handlers/generate_new.rs4
-rw-r--r--crates/ra_assists/src/handlers/inline_local_variable.rs2
-rw-r--r--crates/ra_assists/src/handlers/introduce_named_lifetime.rs4
-rw-r--r--crates/ra_assists/src/handlers/invert_if.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_imports.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_match_arms.rs2
-rw-r--r--crates/ra_assists/src/handlers/move_bounds.rs2
-rw-r--r--crates/ra_assists/src/handlers/move_guard.rs2
-rw-r--r--crates/ra_assists/src/handlers/raw_string.rs2
-rw-r--r--crates/ra_assists/src/handlers/remove_dbg.rs2
-rw-r--r--crates/ra_assists/src/handlers/remove_mut.rs2
-rw-r--r--crates/ra_assists/src/handlers/reorder_fields.rs2
-rw-r--r--crates/ra_assists/src/handlers/replace_if_let_with_match.rs2
-rw-r--r--crates/ra_assists/src/handlers/replace_let_with_if_let.rs2
-rw-r--r--crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs2
-rw-r--r--crates/ra_assists/src/handlers/replace_unwrap_with_match.rs2
-rw-r--r--crates/ra_assists/src/handlers/split_import.rs2
-rw-r--r--crates/ra_assists/src/handlers/unwrap_block.rs2
-rw-r--r--crates/ra_assists/src/lib.rs2
-rw-r--r--crates/ra_assists/src/tests.rs2
-rw-r--r--crates/ra_assists/src/utils.rs4
-rw-r--r--crates/ra_assists/src/utils/insert_use.rs2
46 files changed, 61 insertions, 67 deletions
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml
index e4a5ee6c1..abc290463 100644
--- a/crates/ra_assists/Cargo.toml
+++ b/crates/ra_assists/Cargo.toml
@@ -15,7 +15,7 @@ either = "1.5.3"
15 15
16stdx = { path = "../stdx" } 16stdx = { path = "../stdx" }
17 17
18ra_syntax = { path = "../ra_syntax" } 18syntax = { path = "../syntax" }
19text_edit = { path = "../text_edit" } 19text_edit = { path = "../text_edit" }
20ra_fmt = { path = "../ra_fmt" } 20ra_fmt = { path = "../ra_fmt" }
21profile = { path = "../profile" } 21profile = { path = "../profile" }
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs
index fcaa1aedc..217f692a4 100644
--- a/crates/ra_assists/src/assist_context.rs
+++ b/crates/ra_assists/src/assist_context.rs
@@ -10,7 +10,7 @@ use ra_ide_db::{
10 source_change::{SourceChange, SourceFileEdit}, 10 source_change::{SourceChange, SourceFileEdit},
11 RootDatabase, 11 RootDatabase,
12}; 12};
13use ra_syntax::{ 13use syntax::{
14 algo::{self, find_node_at_offset, SyntaxRewriter}, 14 algo::{self, find_node_at_offset, SyntaxRewriter},
15 AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize, 15 AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize,
16 TokenAtOffset, 16 TokenAtOffset,
@@ -271,7 +271,7 @@ impl AssistBuilder {
271 } 271 }
272 /// Replaces specified `node` of text with a given string, reindenting the 272 /// Replaces specified `node` of text with a given string, reindenting the
273 /// string to maintain `node`'s existing indent. 273 /// string to maintain `node`'s existing indent.
274 // FIXME: remove in favor of ra_syntax::edit::IndentLevel::increase_indent 274 // FIXME: remove in favor of syntax::edit::IndentLevel::increase_indent
275 pub(crate) fn replace_node_and_indent( 275 pub(crate) fn replace_node_and_indent(
276 &mut self, 276 &mut self,
277 node: &SyntaxNode, 277 node: &SyntaxNode,
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index 07c978378..4c41c16d8 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -2,13 +2,13 @@
2use rustc_hash::FxHashMap; 2use rustc_hash::FxHashMap;
3 3
4use hir::{HirDisplay, PathResolution, SemanticsScope}; 4use hir::{HirDisplay, PathResolution, SemanticsScope};
5use ra_syntax::{ 5use syntax::{
6 algo::SyntaxRewriter, 6 algo::SyntaxRewriter,
7 ast::{self, AstNode}, 7 ast::{self, AstNode},
8}; 8};
9 9
10pub trait AstTransform<'a> { 10pub trait AstTransform<'a> {
11 fn get_substitution(&self, node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode>; 11 fn get_substitution(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode>;
12 12
13 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a>; 13 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a>;
14 fn or<T: AstTransform<'a> + 'a>(self, other: T) -> Box<dyn AstTransform<'a> + 'a> 14 fn or<T: AstTransform<'a> + 'a>(self, other: T) -> Box<dyn AstTransform<'a> + 'a>
@@ -22,7 +22,7 @@ pub trait AstTransform<'a> {
22struct NullTransformer; 22struct NullTransformer;
23 23
24impl<'a> AstTransform<'a> for NullTransformer { 24impl<'a> AstTransform<'a> for NullTransformer {
25 fn get_substitution(&self, _node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode> { 25 fn get_substitution(&self, _node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
26 None 26 None
27 } 27 }
28 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> { 28 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {
@@ -101,10 +101,7 @@ impl<'a> SubstituteTypeParams<'a> {
101 Some(result) 101 Some(result)
102 } 102 }
103 } 103 }
104 fn get_substitution_inner( 104 fn get_substitution_inner(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
105 &self,
106 node: &ra_syntax::SyntaxNode,
107 ) -> Option<ra_syntax::SyntaxNode> {
108 let type_ref = ast::Type::cast(node.clone())?; 105 let type_ref = ast::Type::cast(node.clone())?;
109 let path = match &type_ref { 106 let path = match &type_ref {
110 ast::Type::PathType(path_type) => path_type.path()?, 107 ast::Type::PathType(path_type) => path_type.path()?,
@@ -122,7 +119,7 @@ impl<'a> SubstituteTypeParams<'a> {
122} 119}
123 120
124impl<'a> AstTransform<'a> for SubstituteTypeParams<'a> { 121impl<'a> AstTransform<'a> for SubstituteTypeParams<'a> {
125 fn get_substitution(&self, node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode> { 122 fn get_substitution(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
126 self.get_substitution_inner(node).or_else(|| self.previous.get_substitution(node)) 123 self.get_substitution_inner(node).or_else(|| self.previous.get_substitution(node))
127 } 124 }
128 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> { 125 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {
@@ -141,10 +138,7 @@ impl<'a> QualifyPaths<'a> {
141 Self { target_scope, source_scope, previous: Box::new(NullTransformer) } 138 Self { target_scope, source_scope, previous: Box::new(NullTransformer) }
142 } 139 }
143 140
144 fn get_substitution_inner( 141 fn get_substitution_inner(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
145 &self,
146 node: &ra_syntax::SyntaxNode,
147 ) -> Option<ra_syntax::SyntaxNode> {
148 // FIXME handle value ns? 142 // FIXME handle value ns?
149 let from = self.target_scope.module()?; 143 let from = self.target_scope.module()?;
150 let p = ast::Path::cast(node.clone())?; 144 let p = ast::Path::cast(node.clone())?;
@@ -183,7 +177,7 @@ impl<'a> QualifyPaths<'a> {
183 177
184pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: N) -> N { 178pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: N) -> N {
185 SyntaxRewriter::from_fn(|element| match element { 179 SyntaxRewriter::from_fn(|element| match element {
186 ra_syntax::SyntaxElement::Node(n) => { 180 syntax::SyntaxElement::Node(n) => {
187 let replacement = transformer.get_substitution(&n)?; 181 let replacement = transformer.get_substitution(&n)?;
188 Some(replacement.into()) 182 Some(replacement.into())
189 } 183 }
@@ -193,7 +187,7 @@ pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: N) -> N {
193} 187}
194 188
195impl<'a> AstTransform<'a> for QualifyPaths<'a> { 189impl<'a> AstTransform<'a> for QualifyPaths<'a> {
196 fn get_substitution(&self, node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode> { 190 fn get_substitution(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
197 self.get_substitution_inner(node).or_else(|| self.previous.get_substitution(node)) 191 self.get_substitution_inner(node).or_else(|| self.previous.get_substitution(node))
198 } 192 }
199 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> { 193 fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {
diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs
index ebdf00e67..8757fa33f 100644
--- a/crates/ra_assists/src/handlers/add_custom_impl.rs
+++ b/crates/ra_assists/src/handlers/add_custom_impl.rs
@@ -1,5 +1,5 @@
1use itertools::Itertools; 1use itertools::Itertools;
2use ra_syntax::{ 2use syntax::{
3 ast::{self, AstNode}, 3 ast::{self, AstNode},
4 Direction, SmolStr, 4 Direction, SmolStr,
5 SyntaxKind::{IDENT, WHITESPACE}, 5 SyntaxKind::{IDENT, WHITESPACE},
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index 135a2ac9c..563cbf505 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -1,5 +1,5 @@
1use hir::HirDisplay; 1use hir::HirDisplay;
2use ra_syntax::{ 2use syntax::{
3 ast::{self, AstNode, LetStmt, NameOwner}, 3 ast::{self, AstNode, LetStmt, NameOwner},
4 TextRange, 4 TextRange,
5}; 5};
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
index dd1406228..81b61ebf8 100644
--- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
@@ -1,5 +1,5 @@
1use hir::HasSource; 1use hir::HasSource;
2use ra_syntax::{ 2use syntax::{
3 ast::{ 3 ast::{
4 self, 4 self,
5 edit::{self, AstNodeEdit, IndentLevel}, 5 edit::{self, AstNodeEdit, IndentLevel},
diff --git a/crates/ra_assists/src/handlers/add_turbo_fish.rs b/crates/ra_assists/src/handlers/add_turbo_fish.rs
index 537322a72..8c7ffae3d 100644
--- a/crates/ra_assists/src/handlers/add_turbo_fish.rs
+++ b/crates/ra_assists/src/handlers/add_turbo_fish.rs
@@ -1,5 +1,5 @@
1use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; 1use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass};
2use ra_syntax::{ast, AstNode, SyntaxKind, T}; 2use syntax::{ast, AstNode, SyntaxKind, T};
3use test_utils::mark; 3use test_utils::mark;
4 4
5use crate::{ 5use crate::{
diff --git a/crates/ra_assists/src/handlers/apply_demorgan.rs b/crates/ra_assists/src/handlers/apply_demorgan.rs
index 3ac4aed7d..1a6fdafda 100644
--- a/crates/ra_assists/src/handlers/apply_demorgan.rs
+++ b/crates/ra_assists/src/handlers/apply_demorgan.rs
@@ -1,4 +1,4 @@
1use ra_syntax::ast::{self, AstNode}; 1use syntax::ast::{self, AstNode};
2 2
3use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKind, Assists}; 3use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKind, Assists};
4 4
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs
index 6ec59ec4d..e19b197d9 100644
--- a/crates/ra_assists/src/handlers/auto_import.rs
+++ b/crates/ra_assists/src/handlers/auto_import.rs
@@ -6,11 +6,11 @@ use hir::{
6 Type, 6 Type,
7}; 7};
8use ra_ide_db::{imports_locator, RootDatabase}; 8use ra_ide_db::{imports_locator, RootDatabase};
9use ra_syntax::{ 9use rustc_hash::FxHashSet;
10use syntax::{
10 ast::{self, AstNode}, 11 ast::{self, AstNode},
11 SyntaxNode, 12 SyntaxNode,
12}; 13};
13use rustc_hash::FxHashSet;
14 14
15use crate::{ 15use crate::{
16 utils::insert_use_statement, AssistContext, AssistId, AssistKind, Assists, GroupLabel, 16 utils::insert_use_statement, AssistContext, AssistId, AssistKind, Assists, GroupLabel,
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
index b83c94404..d5a68a24c 100644
--- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs
+++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{self, BlockExpr, Expr, LoopBodyOwner}, 2 ast::{self, BlockExpr, Expr, LoopBodyOwner},
3 AstNode, SyntaxNode, 3 AstNode, SyntaxNode,
4}; 4};
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs
index 724daa93f..32dc05378 100644
--- a/crates/ra_assists/src/handlers/change_visibility.rs
+++ b/crates/ra_assists/src/handlers/change_visibility.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{self, NameOwner, VisibilityOwner}, 2 ast::{self, NameOwner, VisibilityOwner},
3 AstNode, 3 AstNode,
4 SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY}, 4 SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY},
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs
index 6816a2709..7fd78e9d4 100644
--- a/crates/ra_assists/src/handlers/early_return.rs
+++ b/crates/ra_assists/src/handlers/early_return.rs
@@ -1,6 +1,6 @@
1use std::{iter::once, ops::RangeInclusive}; 1use std::{iter::once, ops::RangeInclusive};
2 2
3use ra_syntax::{ 3use syntax::{
4 algo::replace_children, 4 algo::replace_children,
5 ast::{ 5 ast::{
6 self, 6 self,
diff --git a/crates/ra_assists/src/handlers/expand_glob_import.rs b/crates/ra_assists/src/handlers/expand_glob_import.rs
index eb216a81a..cf34ffaf7 100644
--- a/crates/ra_assists/src/handlers/expand_glob_import.rs
+++ b/crates/ra_assists/src/handlers/expand_glob_import.rs
@@ -3,7 +3,7 @@ use ra_ide_db::{
3 defs::{classify_name_ref, Definition, NameRefClass}, 3 defs::{classify_name_ref, Definition, NameRefClass},
4 RootDatabase, 4 RootDatabase,
5}; 5};
6use ra_syntax::{algo, ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T}; 6use syntax::{algo, ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T};
7 7
8use crate::{ 8use crate::{
9 assist_context::{AssistBuilder, AssistContext, Assists}, 9 assist_context::{AssistBuilder, AssistContext, Assists},
diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
index ccec688ca..6e9f2d0fc 100644
--- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -2,12 +2,12 @@ use hir::{EnumVariant, Module, ModuleDef, Name};
2use ra_db::FileId; 2use ra_db::FileId;
3use ra_fmt::leading_indent; 3use ra_fmt::leading_indent;
4use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; 4use ra_ide_db::{defs::Definition, search::Reference, RootDatabase};
5use ra_syntax::{ 5use rustc_hash::FxHashSet;
6use syntax::{
6 algo::find_node_at_offset, 7 algo::find_node_at_offset,
7 ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner}, 8 ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner},
8 SourceFile, SyntaxNode, TextRange, TextSize, 9 SourceFile, SyntaxNode, TextRange, TextSize,
9}; 10};
10use rustc_hash::FxHashSet;
11 11
12use crate::{ 12use crate::{
13 assist_context::AssistBuilder, utils::insert_use_statement, AssistContext, AssistId, 13 assist_context::AssistBuilder, utils::insert_use_statement, AssistContext, AssistId,
diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs
index cc62db0c4..d2ae137cd 100644
--- a/crates/ra_assists/src/handlers/extract_variable.rs
+++ b/crates/ra_assists/src/handlers/extract_variable.rs
@@ -1,11 +1,11 @@
1use ra_syntax::{ 1use stdx::format_to;
2use syntax::{
2 ast::{self, AstNode}, 3 ast::{self, AstNode},
3 SyntaxKind::{ 4 SyntaxKind::{
4 BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, 5 BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
5 }, 6 },
6 SyntaxNode, 7 SyntaxNode,
7}; 8};
8use stdx::format_to;
9use test_utils::mark; 9use test_utils::mark;
10 10
11use crate::{AssistContext, AssistId, AssistKind, Assists}; 11use crate::{AssistContext, AssistId, AssistKind, Assists};
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs
index 6698d1a27..8f6660637 100644
--- a/crates/ra_assists/src/handlers/fill_match_arms.rs
+++ b/crates/ra_assists/src/handlers/fill_match_arms.rs
@@ -3,7 +3,7 @@ use std::iter;
3use hir::{Adt, HasSource, ModuleDef, Semantics}; 3use hir::{Adt, HasSource, ModuleDef, Semantics};
4use itertools::Itertools; 4use itertools::Itertools;
5use ra_ide_db::RootDatabase; 5use ra_ide_db::RootDatabase;
6use ra_syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; 6use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat};
7use test_utils::mark; 7use test_utils::mark;
8 8
9use crate::{ 9use crate::{
diff --git a/crates/ra_assists/src/handlers/fix_visibility.rs b/crates/ra_assists/src/handlers/fix_visibility.rs
index a19dbf33f..b6cc1a320 100644
--- a/crates/ra_assists/src/handlers/fix_visibility.rs
+++ b/crates/ra_assists/src/handlers/fix_visibility.rs
@@ -1,6 +1,6 @@
1use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution}; 1use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
2use ra_db::FileId; 2use ra_db::FileId;
3use ra_syntax::{ast, AstNode, TextRange, TextSize}; 3use syntax::{ast, AstNode, TextRange, TextSize};
4 4
5use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists}; 5use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists};
6use ast::VisibilityOwner; 6use ast::VisibilityOwner;
diff --git a/crates/ra_assists/src/handlers/flip_binexpr.rs b/crates/ra_assists/src/handlers/flip_binexpr.rs
index 3cd532650..404f06133 100644
--- a/crates/ra_assists/src/handlers/flip_binexpr.rs
+++ b/crates/ra_assists/src/handlers/flip_binexpr.rs
@@ -1,4 +1,4 @@
1use ra_syntax::ast::{AstNode, BinExpr, BinOp}; 1use syntax::ast::{AstNode, BinExpr, BinOp};
2 2
3use crate::{AssistContext, AssistId, AssistKind, Assists}; 3use crate::{AssistContext, AssistId, AssistKind, Assists};
4 4
diff --git a/crates/ra_assists/src/handlers/flip_comma.rs b/crates/ra_assists/src/handlers/flip_comma.rs
index 55a971dc7..5c69db53e 100644
--- a/crates/ra_assists/src/handlers/flip_comma.rs
+++ b/crates/ra_assists/src/handlers/flip_comma.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{algo::non_trivia_sibling, Direction, T}; 1use syntax::{algo::non_trivia_sibling, Direction, T};
2 2
3use crate::{AssistContext, AssistId, AssistKind, Assists}; 3use crate::{AssistContext, AssistId, AssistKind, Assists};
4 4
diff --git a/crates/ra_assists/src/handlers/flip_trait_bound.rs b/crates/ra_assists/src/handlers/flip_trait_bound.rs
index 1234f4d29..347e79b1d 100644
--- a/crates/ra_assists/src/handlers/flip_trait_bound.rs
+++ b/crates/ra_assists/src/handlers/flip_trait_bound.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 algo::non_trivia_sibling, 2 algo::non_trivia_sibling,
3 ast::{self, AstNode}, 3 ast::{self, AstNode},
4 Direction, T, 4 Direction, T,
diff --git a/crates/ra_assists/src/handlers/generate_derive.rs b/crates/ra_assists/src/handlers/generate_derive.rs
index 90ece9fab..314504e15 100644
--- a/crates/ra_assists/src/handlers/generate_derive.rs
+++ b/crates/ra_assists/src/handlers/generate_derive.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{self, AstNode, AttrsOwner}, 2 ast::{self, AstNode, AttrsOwner},
3 SyntaxKind::{COMMENT, WHITESPACE}, 3 SyntaxKind::{COMMENT, WHITESPACE},
4 TextSize, 4 TextSize,
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
index 4c1aef8a2..302b6b67d 100644
--- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
@@ -1,5 +1,5 @@
1use ra_ide_db::RootDatabase; 1use ra_ide_db::RootDatabase;
2use ra_syntax::ast::{self, AstNode, NameOwner}; 2use syntax::ast::{self, AstNode, NameOwner};
3use test_utils::mark; 3use test_utils::mark;
4 4
5use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists}; 5use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists};
diff --git a/crates/ra_assists/src/handlers/generate_function.rs b/crates/ra_assists/src/handlers/generate_function.rs
index acc97e648..b5df44101 100644
--- a/crates/ra_assists/src/handlers/generate_function.rs
+++ b/crates/ra_assists/src/handlers/generate_function.rs
@@ -1,6 +1,7 @@
1use hir::HirDisplay; 1use hir::HirDisplay;
2use ra_db::FileId; 2use ra_db::FileId;
3use ra_syntax::{ 3use rustc_hash::{FxHashMap, FxHashSet};
4use syntax::{
4 ast::{ 5 ast::{
5 self, 6 self,
6 edit::{AstNodeEdit, IndentLevel}, 7 edit::{AstNodeEdit, IndentLevel},
@@ -8,7 +9,6 @@ use ra_syntax::{
8 }, 9 },
9 SyntaxKind, SyntaxNode, TextSize, 10 SyntaxKind, SyntaxNode, TextSize,
10}; 11};
11use rustc_hash::{FxHashMap, FxHashSet};
12 12
13use crate::{ 13use crate::{
14 assist_config::SnippetCap, 14 assist_config::SnippetCap,
diff --git a/crates/ra_assists/src/handlers/generate_impl.rs b/crates/ra_assists/src/handlers/generate_impl.rs
index 7162dc184..9989109b5 100644
--- a/crates/ra_assists/src/handlers/generate_impl.rs
+++ b/crates/ra_assists/src/handlers/generate_impl.rs
@@ -1,6 +1,6 @@
1use itertools::Itertools; 1use itertools::Itertools;
2use ra_syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner};
3use stdx::format_to; 2use stdx::format_to;
3use syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner};
4 4
5use crate::{AssistContext, AssistId, AssistKind, Assists}; 5use crate::{AssistContext, AssistId, AssistKind, Assists};
6 6
diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs
index 32dfed274..7db10f276 100644
--- a/crates/ra_assists/src/handlers/generate_new.rs
+++ b/crates/ra_assists/src/handlers/generate_new.rs
@@ -1,10 +1,10 @@
1use hir::Adt; 1use hir::Adt;
2use itertools::Itertools; 2use itertools::Itertools;
3use ra_syntax::{ 3use stdx::format_to;
4use syntax::{
4 ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner}, 5 ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner},
5 T, 6 T,
6}; 7};
7use stdx::format_to;
8 8
9use crate::{AssistContext, AssistId, AssistKind, Assists}; 9use crate::{AssistContext, AssistId, AssistKind, Assists};
10 10
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs
index 3c58020f8..531592320 100644
--- a/crates/ra_assists/src/handlers/inline_local_variable.rs
+++ b/crates/ra_assists/src/handlers/inline_local_variable.rs
@@ -1,5 +1,5 @@
1use ra_ide_db::defs::Definition; 1use ra_ide_db::defs::Definition;
2use ra_syntax::{ 2use syntax::{
3 ast::{self, AstNode, AstToken}, 3 ast::{self, AstNode, AstToken},
4 TextRange, 4 TextRange,
5}; 5};
diff --git a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
index fbaf3c06b..5f623e5f7 100644
--- a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
+++ b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
@@ -1,8 +1,8 @@
1use ra_syntax::{ 1use rustc_hash::FxHashSet;
2use syntax::{
2 ast::{self, GenericParamsOwner, NameOwner}, 3 ast::{self, GenericParamsOwner, NameOwner},
3 AstNode, SyntaxKind, TextRange, TextSize, 4 AstNode, SyntaxKind, TextRange, TextSize,
4}; 5};
5use rustc_hash::FxHashSet;
6 6
7use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists}; 7use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists};
8 8
diff --git a/crates/ra_assists/src/handlers/invert_if.rs b/crates/ra_assists/src/handlers/invert_if.rs
index bbe3f3643..f0e047538 100644
--- a/crates/ra_assists/src/handlers/invert_if.rs
+++ b/crates/ra_assists/src/handlers/invert_if.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 T, 3 T,
4}; 4};
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs
index c775fe25c..9c5c6eda7 100644
--- a/crates/ra_assists/src/handlers/merge_imports.rs
+++ b/crates/ra_assists/src/handlers/merge_imports.rs
@@ -1,6 +1,6 @@
1use std::iter::successors; 1use std::iter::successors;
2 2
3use ra_syntax::{ 3use syntax::{
4 algo::{neighbor, skip_trivia_token, SyntaxRewriter}, 4 algo::{neighbor, skip_trivia_token, SyntaxRewriter},
5 ast::{self, edit::AstNodeEdit, make}, 5 ast::{self, edit::AstNodeEdit, make},
6 AstNode, Direction, InsertPosition, SyntaxElement, T, 6 AstNode, Direction, InsertPosition, SyntaxElement, T,
diff --git a/crates/ra_assists/src/handlers/merge_match_arms.rs b/crates/ra_assists/src/handlers/merge_match_arms.rs
index 563292282..c347eb40e 100644
--- a/crates/ra_assists/src/handlers/merge_match_arms.rs
+++ b/crates/ra_assists/src/handlers/merge_match_arms.rs
@@ -1,6 +1,6 @@
1use std::iter::successors; 1use std::iter::successors;
2 2
3use ra_syntax::{ 3use syntax::{
4 algo::neighbor, 4 algo::neighbor,
5 ast::{self, AstNode}, 5 ast::{self, AstNode},
6 Direction, 6 Direction,
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs
index 6d394443e..e2e461520 100644
--- a/crates/ra_assists/src/handlers/move_bounds.rs
+++ b/crates/ra_assists/src/handlers/move_bounds.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner}, 2 ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner},
3 match_ast, 3 match_ast,
4 SyntaxKind::*, 4 SyntaxKind::*,
diff --git a/crates/ra_assists/src/handlers/move_guard.rs b/crates/ra_assists/src/handlers/move_guard.rs
index 4060d34c6..c62ebc306 100644
--- a/crates/ra_assists/src/handlers/move_guard.rs
+++ b/crates/ra_assists/src/handlers/move_guard.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{AstNode, IfExpr, MatchArm}, 2 ast::{AstNode, IfExpr, MatchArm},
3 SyntaxKind::WHITESPACE, 3 SyntaxKind::WHITESPACE,
4}; 4};
diff --git a/crates/ra_assists/src/handlers/raw_string.rs b/crates/ra_assists/src/handlers/raw_string.rs
index 4c797178f..9ddd116e0 100644
--- a/crates/ra_assists/src/handlers/raw_string.rs
+++ b/crates/ra_assists/src/handlers/raw_string.rs
@@ -1,6 +1,6 @@
1use std::borrow::Cow; 1use std::borrow::Cow;
2 2
3use ra_syntax::{ 3use syntax::{
4 ast::{self, HasQuotes, HasStringValue}, 4 ast::{self, HasQuotes, HasStringValue},
5 AstToken, 5 AstToken,
6 SyntaxKind::{RAW_STRING, STRING}, 6 SyntaxKind::{RAW_STRING, STRING},
diff --git a/crates/ra_assists/src/handlers/remove_dbg.rs b/crates/ra_assists/src/handlers/remove_dbg.rs
index 9430ce1b5..f3dcca534 100644
--- a/crates/ra_assists/src/handlers/remove_dbg.rs
+++ b/crates/ra_assists/src/handlers/remove_dbg.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ 1use syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 TextRange, TextSize, T, 3 TextRange, TextSize, T,
4}; 4};
diff --git a/crates/ra_assists/src/handlers/remove_mut.rs b/crates/ra_assists/src/handlers/remove_mut.rs
index ef55c354e..44f41daa9 100644
--- a/crates/ra_assists/src/handlers/remove_mut.rs
+++ b/crates/ra_assists/src/handlers/remove_mut.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{SyntaxKind, TextRange, T}; 1use syntax::{SyntaxKind, TextRange, T};
2 2
3use crate::{AssistContext, AssistId, AssistKind, Assists}; 3use crate::{AssistContext, AssistId, AssistKind, Assists};
4 4
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs
index c9b743a06..013720dfc 100644
--- a/crates/ra_assists/src/handlers/reorder_fields.rs
+++ b/crates/ra_assists/src/handlers/reorder_fields.rs
@@ -3,7 +3,7 @@ use rustc_hash::FxHashMap;
3 3
4use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; 4use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct};
5use ra_ide_db::RootDatabase; 5use ra_ide_db::RootDatabase;
6use ra_syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; 6use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode};
7 7
8use crate::{AssistContext, AssistId, AssistKind, Assists}; 8use crate::{AssistContext, AssistId, AssistKind, Assists};
9 9
diff --git a/crates/ra_assists/src/handlers/replace_if_let_with_match.rs b/crates/ra_assists/src/handlers/replace_if_let_with_match.rs
index ecafb74a1..2442f049b 100644
--- a/crates/ra_assists/src/handlers/replace_if_let_with_match.rs
+++ b/crates/ra_assists/src/handlers/replace_if_let_with_match.rs
@@ -1,5 +1,5 @@
1use ra_fmt::unwrap_trivial_block; 1use ra_fmt::unwrap_trivial_block;
2use ra_syntax::{ 2use syntax::{
3 ast::{ 3 ast::{
4 self, 4 self,
5 edit::{AstNodeEdit, IndentLevel}, 5 edit::{AstNodeEdit, IndentLevel},
diff --git a/crates/ra_assists/src/handlers/replace_let_with_if_let.rs b/crates/ra_assists/src/handlers/replace_let_with_if_let.rs
index e4d436dec..ed6d0c29b 100644
--- a/crates/ra_assists/src/handlers/replace_let_with_if_let.rs
+++ b/crates/ra_assists/src/handlers/replace_let_with_if_let.rs
@@ -1,6 +1,6 @@
1use std::iter::once; 1use std::iter::once;
2 2
3use ra_syntax::{ 3use syntax::{
4 ast::{ 4 ast::{
5 self, 5 self,
6 edit::{AstNodeEdit, IndentLevel}, 6 edit::{AstNodeEdit, IndentLevel},
diff --git a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
index da0a860c5..011bf1106 100644
--- a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
+++ b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
@@ -1,5 +1,5 @@
1use hir; 1use hir;
2use ra_syntax::{algo::SyntaxRewriter, ast, match_ast, AstNode, SmolStr, SyntaxNode}; 2use syntax::{algo::SyntaxRewriter, ast, match_ast, AstNode, SmolStr, SyntaxNode};
3 3
4use crate::{ 4use crate::{
5 utils::{find_insert_use_container, insert_use_statement}, 5 utils::{find_insert_use_container, insert_use_statement},
diff --git a/crates/ra_assists/src/handlers/replace_unwrap_with_match.rs b/crates/ra_assists/src/handlers/replace_unwrap_with_match.rs
index d69f2c1b0..9705f11b7 100644
--- a/crates/ra_assists/src/handlers/replace_unwrap_with_match.rs
+++ b/crates/ra_assists/src/handlers/replace_unwrap_with_match.rs
@@ -1,6 +1,6 @@
1use std::iter; 1use std::iter;
2 2
3use ra_syntax::{ 3use syntax::{
4 ast::{ 4 ast::{
5 self, 5 self,
6 edit::{AstNodeEdit, IndentLevel}, 6 edit::{AstNodeEdit, IndentLevel},
diff --git a/crates/ra_assists/src/handlers/split_import.rs b/crates/ra_assists/src/handlers/split_import.rs
index 4ca5c3ca1..15e67eaa1 100644
--- a/crates/ra_assists/src/handlers/split_import.rs
+++ b/crates/ra_assists/src/handlers/split_import.rs
@@ -1,6 +1,6 @@
1use std::iter::successors; 1use std::iter::successors;
2 2
3use ra_syntax::{ast, AstNode, T}; 3use syntax::{ast, AstNode, T};
4 4
5use crate::{AssistContext, AssistId, AssistKind, Assists}; 5use crate::{AssistContext, AssistId, AssistKind, Assists};
6 6
diff --git a/crates/ra_assists/src/handlers/unwrap_block.rs b/crates/ra_assists/src/handlers/unwrap_block.rs
index 8b38695a9..2879090b8 100644
--- a/crates/ra_assists/src/handlers/unwrap_block.rs
+++ b/crates/ra_assists/src/handlers/unwrap_block.rs
@@ -1,5 +1,5 @@
1use ra_fmt::unwrap_trivial_block; 1use ra_fmt::unwrap_trivial_block;
2use ra_syntax::{ 2use syntax::{
3 ast::{ 3 ast::{
4 self, 4 self,
5 edit::{AstNodeEdit, IndentLevel}, 5 edit::{AstNodeEdit, IndentLevel},
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 890996a68..e2ef561fe 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -20,7 +20,7 @@ pub mod ast_transform;
20use hir::Semantics; 20use hir::Semantics;
21use ra_db::FileRange; 21use ra_db::FileRange;
22use ra_ide_db::{source_change::SourceChange, RootDatabase}; 22use ra_ide_db::{source_change::SourceChange, RootDatabase};
23use ra_syntax::TextRange; 23use syntax::TextRange;
24 24
25pub(crate) use crate::assist_context::{AssistContext, Assists}; 25pub(crate) use crate::assist_context::{AssistContext, Assists};
26 26
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs
index e73836422..1ae7aaa09 100644
--- a/crates/ra_assists/src/tests.rs
+++ b/crates/ra_assists/src/tests.rs
@@ -3,7 +3,7 @@ mod generated;
3use hir::Semantics; 3use hir::Semantics;
4use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; 4use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
5use ra_ide_db::RootDatabase; 5use ra_ide_db::RootDatabase;
6use ra_syntax::TextRange; 6use syntax::TextRange;
7use test_utils::{assert_eq_text, extract_offset, extract_range}; 7use test_utils::{assert_eq_text, extract_offset, extract_range};
8 8
9use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, AssistKind, Assists}; 9use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, AssistKind, Assists};
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index 0de6fdf3f..6d85661c4 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -5,13 +5,13 @@ use std::{iter, ops};
5 5
6use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; 6use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type};
7use ra_ide_db::RootDatabase; 7use ra_ide_db::RootDatabase;
8use ra_syntax::{ 8use rustc_hash::FxHashSet;
9use syntax::{
9 ast::{self, make, NameOwner}, 10 ast::{self, make, NameOwner},
10 AstNode, 11 AstNode,
11 SyntaxKind::*, 12 SyntaxKind::*,
12 SyntaxNode, TextSize, T, 13 SyntaxNode, TextSize, T,
13}; 14};
14use rustc_hash::FxHashSet;
15 15
16use crate::assist_config::SnippetCap; 16use crate::assist_config::SnippetCap;
17 17
diff --git a/crates/ra_assists/src/utils/insert_use.rs b/crates/ra_assists/src/utils/insert_use.rs
index 13dbe1919..f89c288da 100644
--- a/crates/ra_assists/src/utils/insert_use.rs
+++ b/crates/ra_assists/src/utils/insert_use.rs
@@ -4,7 +4,7 @@
4 4
5use either::Either; 5use either::Either;
6use hir::{self, ModPath}; 6use hir::{self, ModPath};
7use ra_syntax::{ 7use syntax::{
8 ast::{self, NameOwner, VisibilityOwner}, 8 ast::{self, NameOwner, VisibilityOwner},
9 AstNode, Direction, SmolStr, 9 AstNode, Direction, SmolStr,
10 SyntaxKind::{PATH, PATH_SEGMENT}, 10 SyntaxKind::{PATH, PATH_SEGMENT},