aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/add_derive.rs4
-rw-r--r--crates/ra_assists/src/add_explicit_type.rs11
-rw-r--r--crates/ra_assists/src/add_impl.rs4
-rw-r--r--crates/ra_assists/src/add_missing_impl_members.rs11
-rw-r--r--crates/ra_assists/src/assist_ctx.rs10
-rw-r--r--crates/ra_assists/src/ast_editor.rs10
-rw-r--r--crates/ra_assists/src/auto_import.rs17
-rw-r--r--crates/ra_assists/src/change_visibility.rs13
-rw-r--r--crates/ra_assists/src/fill_match_arms.rs9
-rw-r--r--crates/ra_assists/src/flip_binexpr.rs4
-rw-r--r--crates/ra_assists/src/flip_comma.rs8
-rw-r--r--crates/ra_assists/src/inline_local_variable.rs4
-rw-r--r--crates/ra_assists/src/introduce_variable.rs12
-rw-r--r--crates/ra_assists/src/lib.rs16
-rw-r--r--crates/ra_assists/src/move_guard.rs9
-rw-r--r--crates/ra_assists/src/remove_dbg.rs5
-rw-r--r--crates/ra_assists/src/replace_if_let_with_match.rs6
-rw-r--r--crates/ra_assists/src/split_import.rs8
18 files changed, 79 insertions, 82 deletions
diff --git a/crates/ra_assists/src/add_derive.rs b/crates/ra_assists/src/add_derive.rs
index 0c4cf2615..bf7d55d6d 100644
--- a/crates/ra_assists/src/add_derive.rs
+++ b/crates/ra_assists/src/add_derive.rs
@@ -1,11 +1,11 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{self, AstNode, AttrsOwner}, 3 ast::{self, AstNode, AttrsOwner},
4 SyntaxKind::{WHITESPACE, COMMENT}, 4 SyntaxKind::{COMMENT, WHITESPACE},
5 TextUnit, 5 TextUnit,
6}; 6};
7 7
8use crate::{AssistCtx, Assist, AssistId}; 8use crate::{Assist, AssistCtx, AssistId};
9 9
10pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let nominal = ctx.node_at_offset::<ast::NominalDef>()?; 11 let nominal = ctx.node_at_offset::<ast::NominalDef>()?;
diff --git a/crates/ra_assists/src/add_explicit_type.rs b/crates/ra_assists/src/add_explicit_type.rs
index f3ed74b7f..bb47a32f0 100644
--- a/crates/ra_assists/src/add_explicit_type.rs
+++ b/crates/ra_assists/src/add_explicit_type.rs
@@ -1,13 +1,10 @@
1use hir::{ 1use hir::{db::HirDatabase, HirDisplay, Ty};
2 HirDisplay, Ty,
3 db::HirDatabase,
4};
5use ra_syntax::{ 2use ra_syntax::{
3 ast::{AstNode, LetStmt, NameOwner, PatKind},
6 T, 4 T,
7 ast::{LetStmt, PatKind, NameOwner, AstNode}
8}; 5};
9 6
10use crate::{AssistCtx, Assist, AssistId}; 7use crate::{Assist, AssistCtx, AssistId};
11 8
12/// Add explicit type assist. 9/// Add explicit type assist.
13pub(crate) fn add_explicit_type(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn add_explicit_type(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
@@ -56,7 +53,7 @@ fn is_unknown(ty: &Ty) -> bool {
56mod tests { 53mod tests {
57 use super::*; 54 use super::*;
58 55
59 use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable }; 56 use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
60 57
61 #[test] 58 #[test]
62 fn add_explicit_type_target() { 59 fn add_explicit_type_target() {
diff --git a/crates/ra_assists/src/add_impl.rs b/crates/ra_assists/src/add_impl.rs
index fa1c85890..b81922c1d 100644
--- a/crates/ra_assists/src/add_impl.rs
+++ b/crates/ra_assists/src/add_impl.rs
@@ -1,11 +1,11 @@
1use join_to_string::join;
2use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use join_to_string::join;
3use ra_syntax::{ 3use ra_syntax::{
4 ast::{self, AstNode, NameOwner, TypeParamsOwner}, 4 ast::{self, AstNode, NameOwner, TypeParamsOwner},
5 TextUnit, 5 TextUnit,
6}; 6};
7 7
8use crate::{AssistCtx, Assist, AssistId}; 8use crate::{Assist, AssistCtx, AssistId};
9 9
10pub(crate) fn add_impl(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn add_impl(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let nominal = ctx.node_at_offset::<ast::NominalDef>()?; 11 let nominal = ctx.node_at_offset::<ast::NominalDef>()?;
diff --git a/crates/ra_assists/src/add_missing_impl_members.rs b/crates/ra_assists/src/add_missing_impl_members.rs
index 0c903a563..7fc8f63b3 100644
--- a/crates/ra_assists/src/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/add_missing_impl_members.rs
@@ -1,9 +1,12 @@
1use crate::{Assist, AssistId, AssistCtx, ast_editor::{AstEditor, AstBuilder}}; 1use crate::{
2 ast_editor::{AstBuilder, AstEditor},
3 Assist, AssistCtx, AssistId,
4};
2 5
3use hir::{HasSource, db::HirDatabase}; 6use hir::{db::HirDatabase, HasSource};
4use ra_syntax::{SmolStr, TreeArc};
5use ra_syntax::ast::{self, AstNode, ImplItem, ImplItemKind, NameOwner};
6use ra_db::FilePosition; 7use ra_db::FilePosition;
8use ra_syntax::ast::{self, AstNode, ImplItem, ImplItemKind, NameOwner};
9use ra_syntax::{SmolStr, TreeArc};
7 10
8#[derive(PartialEq)] 11#[derive(PartialEq)]
9enum AddMissingImplMembersMode { 12enum AddMissingImplMembersMode {
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs
index 1d58d9e71..0ba5f3ae6 100644
--- a/crates/ra_assists/src/assist_ctx.rs
+++ b/crates/ra_assists/src/assist_ctx.rs
@@ -1,13 +1,13 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_text_edit::TextEditBuilder;
3use ra_db::FileRange; 2use ra_db::FileRange;
3use ra_fmt::{leading_indent, reindent};
4use ra_syntax::{ 4use ra_syntax::{
5 SourceFile, TextRange, AstNode, TextUnit, SyntaxNode, SyntaxElement, SyntaxToken, 5 algo::{find_covering_element, find_node_at_offset, find_token_at_offset, TokenAtOffset},
6 algo::{find_token_at_offset, find_node_at_offset, find_covering_element, TokenAtOffset}, 6 AstNode, SourceFile, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextUnit,
7}; 7};
8use ra_fmt::{leading_indent, reindent}; 8use ra_text_edit::TextEditBuilder;
9 9
10use crate::{AssistLabel, AssistAction, AssistId}; 10use crate::{AssistAction, AssistId, AssistLabel};
11 11
12#[derive(Clone, Debug)] 12#[derive(Clone, Debug)]
13pub(crate) enum Assist { 13pub(crate) enum Assist {
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs
index 5f8ba3df6..c9a5cf8d9 100644
--- a/crates/ra_assists/src/ast_editor.rs
+++ b/crates/ra_assists/src/ast_editor.rs
@@ -1,10 +1,12 @@
1use std::{iter, ops::RangeInclusive}; 1use std::{iter, ops::RangeInclusive};
2 2
3use arrayvec::ArrayVec; 3use arrayvec::ArrayVec;
4use ra_text_edit::TextEditBuilder;
5use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction, T};
6use ra_fmt::leading_indent;
7use hir::Name; 4use hir::Name;
5use ra_fmt::leading_indent;
6use ra_syntax::{
7 ast, AstNode, Direction, InsertPosition, SourceFile, SyntaxElement, SyntaxKind::*, TreeArc, T,
8};
9use ra_text_edit::TextEditBuilder;
8 10
9pub struct AstEditor<N: AstNode> { 11pub struct AstEditor<N: AstNode> {
10 original_ast: TreeArc<N>, 12 original_ast: TreeArc<N>,
@@ -283,7 +285,7 @@ fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> {
283 285
284mod tokens { 286mod tokens {
285 use once_cell::sync::Lazy; 287 use once_cell::sync::Lazy;
286 use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*, T}; 288 use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T};
287 289
288 static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree); 290 static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree);
289 291
diff --git a/crates/ra_assists/src/auto_import.rs b/crates/ra_assists/src/auto_import.rs
index 9617beb5c..75ab8fa0f 100644
--- a/crates/ra_assists/src/auto_import.rs
+++ b/crates/ra_assists/src/auto_import.rs
@@ -1,14 +1,15 @@
1use hir::{self, db::HirDatabase};
1use ra_text_edit::TextEditBuilder; 2use ra_text_edit::TextEditBuilder;
2use hir::{ self, db::HirDatabase};
3 3
4use ra_syntax::{
5 T,
6 ast::{ self, NameOwner }, AstNode, SyntaxNode, Direction, TextRange, SmolStr,
7 SyntaxKind::{ PATH, PATH_SEGMENT }
8};
9use crate::{ 4use crate::{
5 assist_ctx::{Assist, AssistCtx},
10 AssistId, 6 AssistId,
11 assist_ctx::{AssistCtx, Assist}, 7};
8use ra_syntax::{
9 ast::{self, NameOwner},
10 AstNode, Direction, SmolStr,
11 SyntaxKind::{PATH, PATH_SEGMENT},
12 SyntaxNode, TextRange, T,
12}; 13};
13 14
14fn collect_path_segments_raw<'a>( 15fn collect_path_segments_raw<'a>(
@@ -577,7 +578,7 @@ pub(crate) fn auto_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
577#[cfg(test)] 578#[cfg(test)]
578mod tests { 579mod tests {
579 use super::*; 580 use super::*;
580 use crate::helpers::{ check_assist, check_assist_not_applicable }; 581 use crate::helpers::{check_assist, check_assist_not_applicable};
581 582
582 #[test] 583 #[test]
583 fn test_auto_import_add_use_no_anchor() { 584 fn test_auto_import_add_use_no_anchor() {
diff --git a/crates/ra_assists/src/change_visibility.rs b/crates/ra_assists/src/change_visibility.rs
index 4eb24d27f..6cabba3e3 100644
--- a/crates/ra_assists/src/change_visibility.rs
+++ b/crates/ra_assists/src/change_visibility.rs
@@ -1,12 +1,15 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 T, 3 ast::{self, NameOwner, VisibilityOwner},
4 AstNode, SyntaxNode, TextUnit, 4 AstNode,
5 ast::{self, VisibilityOwner, NameOwner}, 5 SyntaxKind::{
6 SyntaxKind::{VISIBILITY, FN_DEF, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF, IDENT, WHITESPACE, COMMENT, ATTR}, 6 ATTR, COMMENT, ENUM_DEF, FN_DEF, IDENT, MODULE, STRUCT_DEF, TRAIT_DEF, VISIBILITY,
7 WHITESPACE,
8 },
9 SyntaxNode, TextUnit, T,
7}; 10};
8 11
9use crate::{AssistCtx, Assist, AssistId}; 12use crate::{Assist, AssistCtx, AssistId};
10 13
11pub(crate) fn change_visibility(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 14pub(crate) fn change_visibility(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
12 if let Some(vis) = ctx.node_at_offset::<ast::Visibility>() { 15 if let Some(vis) = ctx.node_at_offset::<ast::Visibility>() {
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs
index 71b101b40..d51010b84 100644
--- a/crates/ra_assists/src/fill_match_arms.rs
+++ b/crates/ra_assists/src/fill_match_arms.rs
@@ -1,13 +1,10 @@
1use std::fmt::Write;
2use itertools::Itertools; 1use itertools::Itertools;
2use std::fmt::Write;
3 3
4use hir::{ 4use hir::{db::HirDatabase, AdtDef, FieldSource, HasSource};
5 AdtDef, FieldSource, HasSource,
6 db::HirDatabase,
7};
8use ra_syntax::ast::{self, AstNode}; 5use ra_syntax::ast::{self, AstNode};
9 6
10use crate::{AssistCtx, Assist, AssistId}; 7use crate::{Assist, AssistCtx, AssistId};
11 8
12fn is_trivial_arm(arm: &ast::MatchArm) -> bool { 9fn is_trivial_arm(arm: &ast::MatchArm) -> bool {
13 fn single_pattern(arm: &ast::MatchArm) -> Option<ast::PatKind> { 10 fn single_pattern(arm: &ast::MatchArm) -> Option<ast::PatKind> {
diff --git a/crates/ra_assists/src/flip_binexpr.rs b/crates/ra_assists/src/flip_binexpr.rs
index 02d27f66d..5e41f9346 100644
--- a/crates/ra_assists/src/flip_binexpr.rs
+++ b/crates/ra_assists/src/flip_binexpr.rs
@@ -1,7 +1,7 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::ast::{AstNode, BinExpr, BinOp}; 2use ra_syntax::ast::{AstNode, BinExpr, BinOp};
3 3
4use crate::{AssistCtx, Assist, AssistId}; 4use crate::{Assist, AssistCtx, AssistId};
5 5
6/// Flip binary expression assist. 6/// Flip binary expression assist.
7pub(crate) fn flip_binexpr(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 7pub(crate) fn flip_binexpr(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
@@ -68,7 +68,7 @@ impl From<BinOp> for FlipAction {
68mod tests { 68mod tests {
69 use super::*; 69 use super::*;
70 70
71 use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable }; 71 use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
72 72
73 #[test] 73 #[test]
74 fn flip_binexpr_target_is_the_op() { 74 fn flip_binexpr_target_is_the_op() {
diff --git a/crates/ra_assists/src/flip_comma.rs b/crates/ra_assists/src/flip_comma.rs
index 7626ffad3..d8dba779f 100644
--- a/crates/ra_assists/src/flip_comma.rs
+++ b/crates/ra_assists/src/flip_comma.rs
@@ -1,11 +1,7 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::{ 2use ra_syntax::{algo::non_trivia_sibling, Direction, T};
3 T,
4 Direction,
5 algo::non_trivia_sibling,
6};
7 3
8use crate::{AssistCtx, Assist, AssistId}; 4use crate::{Assist, AssistCtx, AssistId};
9 5
10pub(crate) fn flip_comma(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 6pub(crate) fn flip_comma(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let comma = ctx.token_at_offset().find(|leaf| leaf.kind() == T![,])?; 7 let comma = ctx.token_at_offset().find(|leaf| leaf.kind() == T![,])?;
diff --git a/crates/ra_assists/src/inline_local_variable.rs b/crates/ra_assists/src/inline_local_variable.rs
index e0479ef13..554de8b46 100644
--- a/crates/ra_assists/src/inline_local_variable.rs
+++ b/crates/ra_assists/src/inline_local_variable.rs
@@ -1,11 +1,11 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{self, AstNode, AstToken, PatKind, ExprKind}, 3 ast::{self, AstNode, AstToken, ExprKind, PatKind},
4 TextRange, 4 TextRange,
5}; 5};
6 6
7use crate::{Assist, AssistCtx, AssistId};
8use crate::assist_ctx::AssistBuilder; 7use crate::assist_ctx::AssistBuilder;
8use crate::{Assist, AssistCtx, AssistId};
9 9
10pub(crate) fn inline_local_varialbe(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn inline_local_varialbe(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let let_stmt = ctx.node_at_offset::<ast::LetStmt>()?; 11 let let_stmt = ctx.node_at_offset::<ast::LetStmt>()?;
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs
index 28467d341..f7f5ccafa 100644
--- a/crates/ra_assists/src/introduce_variable.rs
+++ b/crates/ra_assists/src/introduce_variable.rs
@@ -1,12 +1,14 @@
1use test_utils::tested_by;
2use hir::db::HirDatabase; 1use hir::db::HirDatabase;
3use ra_syntax::{ 2use ra_syntax::{
4 ast::{self, AstNode}, 3 ast::{self, AstNode},
4 SyntaxKind::{
5 BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, WHITESPACE,
6 },
5 SyntaxNode, TextUnit, 7 SyntaxNode, TextUnit,
6 SyntaxKind::{WHITESPACE, MATCH_ARM, LAMBDA_EXPR, PATH_EXPR, BREAK_EXPR, LOOP_EXPR, RETURN_EXPR, COMMENT},
7}; 8};
9use test_utils::tested_by;
8 10
9use crate::{AssistCtx, Assist, AssistId}; 11use crate::{Assist, AssistCtx, AssistId};
10 12
11pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 13pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
12 if ctx.frange.range.is_empty() { 14 if ctx.frange.range.is_empty() {
@@ -121,7 +123,9 @@ fn anchor_stmt(expr: &ast::Expr) -> Option<(&SyntaxNode, bool)> {
121mod tests { 123mod tests {
122 use test_utils::covers; 124 use test_utils::covers;
123 125
124 use crate::helpers::{check_assist_range_not_applicable, check_assist_range, check_assist_range_target}; 126 use crate::helpers::{
127 check_assist_range, check_assist_range_not_applicable, check_assist_range_target,
128 };
125 129
126 use super::*; 130 use super::*;
127 131
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 28eb0226b..0d848629d 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -11,12 +11,12 @@ pub mod ast_editor;
11 11
12use itertools::Itertools; 12use itertools::Itertools;
13 13
14use ra_text_edit::TextEdit;
15use ra_syntax::{TextRange, TextUnit};
16use ra_db::FileRange;
17use hir::db::HirDatabase; 14use hir::db::HirDatabase;
15use ra_db::FileRange;
16use ra_syntax::{TextRange, TextUnit};
17use ra_text_edit::TextEdit;
18 18
19pub(crate) use crate::assist_ctx::{AssistCtx, Assist}; 19pub(crate) use crate::assist_ctx::{Assist, AssistCtx};
20 20
21/// Unique identifier of the assist, should not be shown to the user 21/// Unique identifier of the assist, should not be shown to the user
22/// directly. 22/// directly.
@@ -127,11 +127,11 @@ fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assis
127#[cfg(test)] 127#[cfg(test)]
128mod helpers { 128mod helpers {
129 use hir::mock::MockDatabase; 129 use hir::mock::MockDatabase;
130 use ra_syntax::TextRange;
131 use ra_db::FileRange; 130 use ra_db::FileRange;
132 use test_utils::{extract_offset, extract_range, assert_eq_text, add_cursor}; 131 use ra_syntax::TextRange;
132 use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range};
133 133
134 use crate::{AssistCtx, Assist}; 134 use crate::{Assist, AssistCtx};
135 135
136 pub(crate) fn check_assist( 136 pub(crate) fn check_assist(
137 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 137 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>,
@@ -289,8 +289,8 @@ mod helpers {
289#[cfg(test)] 289#[cfg(test)]
290mod tests { 290mod tests {
291 use hir::mock::MockDatabase; 291 use hir::mock::MockDatabase;
292 use ra_syntax::TextRange;
293 use ra_db::FileRange; 292 use ra_db::FileRange;
293 use ra_syntax::TextRange;
294 use test_utils::{extract_offset, extract_range}; 294 use test_utils::{extract_offset, extract_range};
295 295
296 #[test] 296 #[test]
diff --git a/crates/ra_assists/src/move_guard.rs b/crates/ra_assists/src/move_guard.rs
index 22ba91fb7..e1ce86a33 100644
--- a/crates/ra_assists/src/move_guard.rs
+++ b/crates/ra_assists/src/move_guard.rs
@@ -1,12 +1,11 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 TextUnit,
4 SyntaxElement,
5 ast::{MatchArm, AstNode, AstToken, IfExpr},
6 ast, 3 ast,
4 ast::{AstNode, AstToken, IfExpr, MatchArm},
5 SyntaxElement, TextUnit,
7}; 6};
8 7
9use crate::{AssistCtx, Assist, AssistId}; 8use crate::{Assist, AssistCtx, AssistId};
10 9
11pub(crate) fn move_guard_to_arm_body(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn move_guard_to_arm_body(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
12 let match_arm = ctx.node_at_offset::<MatchArm>()?; 11 let match_arm = ctx.node_at_offset::<MatchArm>()?;
@@ -84,7 +83,7 @@ pub(crate) fn move_arm_cond_to_match_guard(mut ctx: AssistCtx<impl HirDatabase>)
84mod tests { 83mod tests {
85 use super::*; 84 use super::*;
86 85
87 use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable }; 86 use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
88 87
89 #[test] 88 #[test]
90 fn move_guard_to_arm_body_target() { 89 fn move_guard_to_arm_body_target() {
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/remove_dbg.rs
index 6e900f8ef..5680f76ca 100644
--- a/crates/ra_assists/src/remove_dbg.rs
+++ b/crates/ra_assists/src/remove_dbg.rs
@@ -1,10 +1,9 @@
1use crate::{Assist, AssistCtx, AssistId};
1use hir::db::HirDatabase; 2use hir::db::HirDatabase;
2use ra_syntax::{ 3use ra_syntax::{
3 ast::{self, AstNode}, 4 ast::{self, AstNode},
4 TextUnit, 5 TextUnit, T,
5 T
6}; 6};
7use crate::{AssistCtx, Assist, AssistId};
8 7
9pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 8pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
10 let macro_call = ctx.node_at_offset::<ast::MacroCall>()?; 9 let macro_call = ctx.node_at_offset::<ast::MacroCall>()?;
diff --git a/crates/ra_assists/src/replace_if_let_with_match.rs b/crates/ra_assists/src/replace_if_let_with_match.rs
index 2b451f08d..c2c7cf70b 100644
--- a/crates/ra_assists/src/replace_if_let_with_match.rs
+++ b/crates/ra_assists/src/replace_if_let_with_match.rs
@@ -1,8 +1,8 @@
1use ra_syntax::{AstNode, ast};
2use ra_fmt::extract_trivial_expression;
3use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_fmt::extract_trivial_expression;
3use ra_syntax::{ast, AstNode};
4 4
5use crate::{AssistCtx, Assist, AssistId}; 5use crate::{Assist, AssistCtx, AssistId};
6 6
7pub(crate) fn replace_if_let_with_match(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 7pub(crate) fn replace_if_let_with_match(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
8 let if_expr: &ast::IfExpr = ctx.node_at_offset()?; 8 let if_expr: &ast::IfExpr = ctx.node_at_offset()?;
diff --git a/crates/ra_assists/src/split_import.rs b/crates/ra_assists/src/split_import.rs
index 881c5ecdc..a8feb67c8 100644
--- a/crates/ra_assists/src/split_import.rs
+++ b/crates/ra_assists/src/split_import.rs
@@ -1,13 +1,9 @@
1use std::iter::successors; 1use std::iter::successors;
2 2
3use hir::db::HirDatabase; 3use hir::db::HirDatabase;
4use ra_syntax::{ 4use ra_syntax::{ast, AstNode, TextUnit, T};
5 T,
6 TextUnit, AstNode,
7 ast,
8};
9 5
10use crate::{AssistCtx, Assist, AssistId}; 6use crate::{Assist, AssistCtx, AssistId};
11 7
12pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 8pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
13 let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == T![::])?; 9 let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == T![::])?;