aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/assists/add_custom_impl.rs2
-rw-r--r--crates/ra_assists/src/assists/add_explicit_type.rs2
-rw-r--r--crates/ra_assists/src/assists/add_missing_impl_members.rs4
-rw-r--r--crates/ra_assists/src/assists/add_new.rs2
-rw-r--r--crates/ra_assists/src/assists/apply_demorgan.rs2
-rw-r--r--crates/ra_assists/src/assists/change_visibility.rs4
-rw-r--r--crates/ra_assists/src/assists/early_return.rs2
-rw-r--r--crates/ra_assists/src/assists/fill_match_arms.rs2
-rw-r--r--crates/ra_assists/src/assists/flip_binexpr.rs2
-rw-r--r--crates/ra_assists/src/assists/flip_comma.rs2
-rw-r--r--crates/ra_assists/src/assists/flip_trait_bound.rs2
-rw-r--r--crates/ra_assists/src/assists/inline_local_variable.rs2
-rw-r--r--crates/ra_assists/src/assists/introduce_variable.rs2
-rw-r--r--crates/ra_assists/src/assists/invert_if.rs2
-rw-r--r--crates/ra_assists/src/assists/merge_match_arms.rs2
-rw-r--r--crates/ra_assists/src/assists/move_bounds.rs2
-rw-r--r--crates/ra_assists/src/assists/move_guard.rs4
-rw-r--r--crates/ra_assists/src/assists/raw_string.rs8
-rw-r--r--crates/ra_assists/src/assists/replace_if_let_with_match.rs2
-rw-r--r--crates/ra_assists/src/assists/split_import.rs2
-rw-r--r--crates/ra_assists/src/lib.rs11
21 files changed, 33 insertions, 30 deletions
diff --git a/crates/ra_assists/src/assists/add_custom_impl.rs b/crates/ra_assists/src/assists/add_custom_impl.rs
index 52e8c693d..f91034967 100644
--- a/crates/ra_assists/src/assists/add_custom_impl.rs
+++ b/crates/ra_assists/src/assists/add_custom_impl.rs
@@ -50,7 +50,7 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
50 let start_offset = annotated.syntax().parent()?.text_range().end(); 50 let start_offset = annotated.syntax().parent()?.text_range().end();
51 51
52 let label = 52 let label =
53 format!("Add Custom impl '{}' for '{}'", trait_token.text().as_str(), annotated_name); 53 format!("Add custom impl '{}' for '{}'", trait_token.text().as_str(), annotated_name);
54 54
55 ctx.add_assist(AssistId("add_custom_impl"), label, |edit| { 55 ctx.add_assist(AssistId("add_custom_impl"), label, |edit| {
56 edit.target(attr.syntax().text_range()); 56 edit.target(attr.syntax().text_range());
diff --git a/crates/ra_assists/src/assists/add_explicit_type.rs b/crates/ra_assists/src/assists/add_explicit_type.rs
index b63ca50d0..f9f826b88 100644
--- a/crates/ra_assists/src/assists/add_explicit_type.rs
+++ b/crates/ra_assists/src/assists/add_explicit_type.rs
@@ -49,7 +49,7 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx<impl HirDatabase>) -> Option<Assi
49 49
50 ctx.add_assist( 50 ctx.add_assist(
51 AssistId("add_explicit_type"), 51 AssistId("add_explicit_type"),
52 format!("Insert Explicit Type '{}'", ty.display(db)), 52 format!("Insert explicit type '{}'", ty.display(db)),
53 |edit| { 53 |edit| {
54 edit.target(pat_range); 54 edit.target(pat_range);
55 edit.insert(name_range.end(), format!(": {}", ty.display(db))); 55 edit.insert(name_range.end(), format!(": {}", ty.display(db)));
diff --git a/crates/ra_assists/src/assists/add_missing_impl_members.rs b/crates/ra_assists/src/assists/add_missing_impl_members.rs
index 89a1d58b8..5bb937bde 100644
--- a/crates/ra_assists/src/assists/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/assists/add_missing_impl_members.rs
@@ -48,7 +48,7 @@ pub(crate) fn add_missing_impl_members(ctx: AssistCtx<impl HirDatabase>) -> Opti
48 ctx, 48 ctx,
49 AddMissingImplMembersMode::NoDefaultMethods, 49 AddMissingImplMembersMode::NoDefaultMethods,
50 "add_impl_missing_members", 50 "add_impl_missing_members",
51 "Implement Missing Members", 51 "Implement missing members",
52 ) 52 )
53} 53}
54 54
@@ -89,7 +89,7 @@ pub(crate) fn add_missing_default_members(ctx: AssistCtx<impl HirDatabase>) -> O
89 ctx, 89 ctx,
90 AddMissingImplMembersMode::DefaultMethodsOnly, 90 AddMissingImplMembersMode::DefaultMethodsOnly,
91 "add_impl_default_members", 91 "add_impl_default_members",
92 "Implement Default Members", 92 "Implement default members",
93 ) 93 )
94} 94}
95 95
diff --git a/crates/ra_assists/src/assists/add_new.rs b/crates/ra_assists/src/assists/add_new.rs
index 9102c2325..d148d6e73 100644
--- a/crates/ra_assists/src/assists/add_new.rs
+++ b/crates/ra_assists/src/assists/add_new.rs
@@ -43,7 +43,7 @@ pub(crate) fn add_new(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
43 // Return early if we've found an existing new fn 43 // Return early if we've found an existing new fn
44 let impl_block = find_struct_impl(&ctx, &strukt)?; 44 let impl_block = find_struct_impl(&ctx, &strukt)?;
45 45
46 ctx.add_assist(AssistId("add_new"), "Add Default Constructor", |edit| { 46 ctx.add_assist(AssistId("add_new"), "Add default constructor", |edit| {
47 edit.target(strukt.syntax().text_range()); 47 edit.target(strukt.syntax().text_range());
48 48
49 let mut buf = String::with_capacity(512); 49 let mut buf = String::with_capacity(512);
diff --git a/crates/ra_assists/src/assists/apply_demorgan.rs b/crates/ra_assists/src/assists/apply_demorgan.rs
index 95585d831..666dce4e6 100644
--- a/crates/ra_assists/src/assists/apply_demorgan.rs
+++ b/crates/ra_assists/src/assists/apply_demorgan.rs
@@ -39,7 +39,7 @@ pub(crate) fn apply_demorgan(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist>
39 let not_lhs = invert_boolean_expression(&lhs)?; 39 let not_lhs = invert_boolean_expression(&lhs)?;
40 let not_rhs = invert_boolean_expression(&rhs)?; 40 let not_rhs = invert_boolean_expression(&rhs)?;
41 41
42 ctx.add_assist(AssistId("apply_demorgan"), "Apply Demorgan's Law", |edit| { 42 ctx.add_assist(AssistId("apply_demorgan"), "Apply De Morgan's law", |edit| {
43 edit.target(op_range); 43 edit.target(op_range);
44 edit.replace(op_range, opposite_op); 44 edit.replace(op_range, opposite_op);
45 edit.replace(lhs_range, format!("!({}", not_lhs.syntax().text())); 45 edit.replace(lhs_range, format!("!({}", not_lhs.syntax().text()));
diff --git a/crates/ra_assists/src/assists/change_visibility.rs b/crates/ra_assists/src/assists/change_visibility.rs
index a51277040..fd766bb46 100644
--- a/crates/ra_assists/src/assists/change_visibility.rs
+++ b/crates/ra_assists/src/assists/change_visibility.rs
@@ -57,7 +57,7 @@ fn add_vis(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
57 (vis_offset(field.syntax()), ident.text_range()) 57 (vis_offset(field.syntax()), ident.text_range())
58 }; 58 };
59 59
60 ctx.add_assist(AssistId("change_visibility"), "Change Visibility to pub(crate)", |edit| { 60 ctx.add_assist(AssistId("change_visibility"), "Change visibility to pub(crate)", |edit| {
61 edit.target(target); 61 edit.target(target);
62 edit.insert(offset, "pub(crate) "); 62 edit.insert(offset, "pub(crate) ");
63 edit.set_cursor(offset); 63 edit.set_cursor(offset);
@@ -88,7 +88,7 @@ fn change_vis(ctx: AssistCtx<impl HirDatabase>, vis: ast::Visibility) -> Option<
88 ); 88 );
89 } 89 }
90 if vis.syntax().text() == "pub(crate)" { 90 if vis.syntax().text() == "pub(crate)" {
91 return ctx.add_assist(AssistId("change_visibility"), "Change Visibility to pub", |edit| { 91 return ctx.add_assist(AssistId("change_visibility"), "Change visibility to pub", |edit| {
92 edit.target(vis.syntax().text_range()); 92 edit.target(vis.syntax().text_range());
93 edit.replace(vis.syntax().text_range(), "pub"); 93 edit.replace(vis.syntax().text_range(), "pub");
94 edit.set_cursor(vis.syntax().text_range().start()); 94 edit.set_cursor(vis.syntax().text_range().start());
diff --git a/crates/ra_assists/src/assists/early_return.rs b/crates/ra_assists/src/assists/early_return.rs
index 6b6319959..487ee9eef 100644
--- a/crates/ra_assists/src/assists/early_return.rs
+++ b/crates/ra_assists/src/assists/early_return.rs
@@ -95,7 +95,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Opt
95 then_block.syntax().last_child_or_token().filter(|t| t.kind() == R_CURLY)?; 95 then_block.syntax().last_child_or_token().filter(|t| t.kind() == R_CURLY)?;
96 let cursor_position = ctx.frange.range.start(); 96 let cursor_position = ctx.frange.range.start();
97 97
98 ctx.add_assist(AssistId("convert_to_guarded_return"), "Convert to Guarded Return", |edit| { 98 ctx.add_assist(AssistId("convert_to_guarded_return"), "Convert to guarded return", |edit| {
99 let if_indent_level = IndentLevel::from_node(&if_expr.syntax()); 99 let if_indent_level = IndentLevel::from_node(&if_expr.syntax());
100 let new_block = match if_let_pat { 100 let new_block = match if_let_pat {
101 None => { 101 None => {
diff --git a/crates/ra_assists/src/assists/fill_match_arms.rs b/crates/ra_assists/src/assists/fill_match_arms.rs
index 90ddfc3d0..01758d23a 100644
--- a/crates/ra_assists/src/assists/fill_match_arms.rs
+++ b/crates/ra_assists/src/assists/fill_match_arms.rs
@@ -57,7 +57,7 @@ pub(crate) fn fill_match_arms(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
57 57
58 let db = ctx.db; 58 let db = ctx.db;
59 59
60 ctx.add_assist(AssistId("fill_match_arms"), "Fill Match Arms", |edit| { 60 ctx.add_assist(AssistId("fill_match_arms"), "Fill match arms", |edit| {
61 let indent_level = IndentLevel::from_node(match_arm_list.syntax()); 61 let indent_level = IndentLevel::from_node(match_arm_list.syntax());
62 62
63 let new_arm_list = { 63 let new_arm_list = {
diff --git a/crates/ra_assists/src/assists/flip_binexpr.rs b/crates/ra_assists/src/assists/flip_binexpr.rs
index 808248d88..2074087cd 100644
--- a/crates/ra_assists/src/assists/flip_binexpr.rs
+++ b/crates/ra_assists/src/assists/flip_binexpr.rs
@@ -34,7 +34,7 @@ pub(crate) fn flip_binexpr(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
34 return None; 34 return None;
35 } 35 }
36 36
37 ctx.add_assist(AssistId("flip_binexpr"), "Flip Binary Expression", |edit| { 37 ctx.add_assist(AssistId("flip_binexpr"), "Flip binary expression", |edit| {
38 edit.target(op_range); 38 edit.target(op_range);
39 if let FlipAction::FlipAndReplaceOp(new_op) = action { 39 if let FlipAction::FlipAndReplaceOp(new_op) = action {
40 edit.replace(op_range, new_op); 40 edit.replace(op_range, new_op);
diff --git a/crates/ra_assists/src/assists/flip_comma.rs b/crates/ra_assists/src/assists/flip_comma.rs
index b274681b3..dd0c405ed 100644
--- a/crates/ra_assists/src/assists/flip_comma.rs
+++ b/crates/ra_assists/src/assists/flip_comma.rs
@@ -29,7 +29,7 @@ pub(crate) fn flip_comma(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
29 return None; 29 return None;
30 } 30 }
31 31
32 ctx.add_assist(AssistId("flip_comma"), "Flip Comma", |edit| { 32 ctx.add_assist(AssistId("flip_comma"), "Flip comma", |edit| {
33 edit.target(comma.text_range()); 33 edit.target(comma.text_range());
34 edit.replace(prev.text_range(), next.to_string()); 34 edit.replace(prev.text_range(), next.to_string());
35 edit.replace(next.text_range(), prev.to_string()); 35 edit.replace(next.text_range(), prev.to_string());
diff --git a/crates/ra_assists/src/assists/flip_trait_bound.rs b/crates/ra_assists/src/assists/flip_trait_bound.rs
index b691c9509..50b3fa492 100644
--- a/crates/ra_assists/src/assists/flip_trait_bound.rs
+++ b/crates/ra_assists/src/assists/flip_trait_bound.rs
@@ -33,7 +33,7 @@ pub(crate) fn flip_trait_bound(ctx: AssistCtx<impl HirDatabase>) -> Option<Assis
33 non_trivia_sibling(plus.clone().into(), Direction::Next)?, 33 non_trivia_sibling(plus.clone().into(), Direction::Next)?,
34 ); 34 );
35 35
36 ctx.add_assist(AssistId("flip_trait_bound"), "Flip Trait Bounds", |edit| { 36 ctx.add_assist(AssistId("flip_trait_bound"), "Flip trait bounds", |edit| {
37 edit.target(plus.text_range()); 37 edit.target(plus.text_range());
38 edit.replace(before.text_range(), after.to_string()); 38 edit.replace(before.text_range(), after.to_string());
39 edit.replace(after.text_range(), before.to_string()); 39 edit.replace(after.text_range(), before.to_string());
diff --git a/crates/ra_assists/src/assists/inline_local_variable.rs b/crates/ra_assists/src/assists/inline_local_variable.rs
index 754ada707..164aee90c 100644
--- a/crates/ra_assists/src/assists/inline_local_variable.rs
+++ b/crates/ra_assists/src/assists/inline_local_variable.rs
@@ -93,7 +93,7 @@ pub(crate) fn inline_local_varialbe(ctx: AssistCtx<impl HirDatabase>) -> Option<
93 93
94 ctx.add_assist( 94 ctx.add_assist(
95 AssistId("inline_local_variable"), 95 AssistId("inline_local_variable"),
96 "Inline Variable", 96 "Inline variable",
97 move |edit: &mut AssistBuilder| { 97 move |edit: &mut AssistBuilder| {
98 edit.delete(delete_range); 98 edit.delete(delete_range);
99 for (desc, should_wrap) in refs.iter().zip(wrap_in_parens) { 99 for (desc, should_wrap) in refs.iter().zip(wrap_in_parens) {
diff --git a/crates/ra_assists/src/assists/introduce_variable.rs b/crates/ra_assists/src/assists/introduce_variable.rs
index 7ac79d910..19e211e0f 100644
--- a/crates/ra_assists/src/assists/introduce_variable.rs
+++ b/crates/ra_assists/src/assists/introduce_variable.rs
@@ -43,7 +43,7 @@ pub(crate) fn introduce_variable(ctx: AssistCtx<impl HirDatabase>) -> Option<Ass
43 if indent.kind() != WHITESPACE { 43 if indent.kind() != WHITESPACE {
44 return None; 44 return None;
45 } 45 }
46 ctx.add_assist(AssistId("introduce_variable"), "Extract into Variable", move |edit| { 46 ctx.add_assist(AssistId("introduce_variable"), "Extract into variable", move |edit| {
47 let mut buf = String::new(); 47 let mut buf = String::new();
48 48
49 let cursor_offset = if wrap_in_block { 49 let cursor_offset = if wrap_in_block {
diff --git a/crates/ra_assists/src/assists/invert_if.rs b/crates/ra_assists/src/assists/invert_if.rs
index 05bd2b037..16352c040 100644
--- a/crates/ra_assists/src/assists/invert_if.rs
+++ b/crates/ra_assists/src/assists/invert_if.rs
@@ -41,7 +41,7 @@ pub(crate) fn invert_if(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
41 let else_node = else_block.syntax(); 41 let else_node = else_block.syntax();
42 let else_range = else_node.text_range(); 42 let else_range = else_node.text_range();
43 let then_range = then_node.text_range(); 43 let then_range = then_node.text_range();
44 return ctx.add_assist(AssistId("invert_if"), "Invert If", |edit| { 44 return ctx.add_assist(AssistId("invert_if"), "Invert if", |edit| {
45 edit.target(if_range); 45 edit.target(if_range);
46 edit.replace(cond_range, flip_cond.syntax().text()); 46 edit.replace(cond_range, flip_cond.syntax().text());
47 edit.replace(else_range, then_node.text()); 47 edit.replace(else_range, then_node.text());
diff --git a/crates/ra_assists/src/assists/merge_match_arms.rs b/crates/ra_assists/src/assists/merge_match_arms.rs
index 6406e1feb..aca391155 100644
--- a/crates/ra_assists/src/assists/merge_match_arms.rs
+++ b/crates/ra_assists/src/assists/merge_match_arms.rs
@@ -52,7 +52,7 @@ pub(crate) fn merge_match_arms(ctx: AssistCtx<impl HirDatabase>) -> Option<Assis
52 52
53 let cursor_to_end = current_arm.syntax().text_range().end() - ctx.frange.range.start(); 53 let cursor_to_end = current_arm.syntax().text_range().end() - ctx.frange.range.start();
54 54
55 ctx.add_assist(AssistId("merge_match_arms"), "Merge Match Arms", |edit| { 55 ctx.add_assist(AssistId("merge_match_arms"), "Merge match arms", |edit| {
56 fn contains_placeholder(a: &MatchArm) -> bool { 56 fn contains_placeholder(a: &MatchArm) -> bool {
57 a.pats().any(|x| match x { 57 a.pats().any(|x| match x {
58 ra_syntax::ast::Pat::PlaceholderPat(..) => true, 58 ra_syntax::ast::Pat::PlaceholderPat(..) => true,
diff --git a/crates/ra_assists/src/assists/move_bounds.rs b/crates/ra_assists/src/assists/move_bounds.rs
index 6e6c1d67d..355adddc3 100644
--- a/crates/ra_assists/src/assists/move_bounds.rs
+++ b/crates/ra_assists/src/assists/move_bounds.rs
@@ -46,7 +46,7 @@ pub(crate) fn move_bounds_to_where_clause(ctx: AssistCtx<impl HirDatabase>) -> O
46 _ => return None, 46 _ => return None,
47 }; 47 };
48 48
49 ctx.add_assist(AssistId("move_bounds_to_where_clause"), "Move to Where Clause", |edit| { 49 ctx.add_assist(AssistId("move_bounds_to_where_clause"), "Move to where clause", |edit| {
50 let new_params = type_param_list 50 let new_params = type_param_list
51 .type_params() 51 .type_params()
52 .filter(|it| it.type_bound_list().is_some()) 52 .filter(|it| it.type_bound_list().is_some())
diff --git a/crates/ra_assists/src/assists/move_guard.rs b/crates/ra_assists/src/assists/move_guard.rs
index 59ba9e3f3..41a31e677 100644
--- a/crates/ra_assists/src/assists/move_guard.rs
+++ b/crates/ra_assists/src/assists/move_guard.rs
@@ -41,7 +41,7 @@ pub(crate) fn move_guard_to_arm_body(ctx: AssistCtx<impl HirDatabase>) -> Option
41 let arm_expr = match_arm.expr()?; 41 let arm_expr = match_arm.expr()?;
42 let buf = format!("if {} {{ {} }}", guard_conditions.syntax().text(), arm_expr.syntax().text()); 42 let buf = format!("if {} {{ {} }}", guard_conditions.syntax().text(), arm_expr.syntax().text());
43 43
44 ctx.add_assist(AssistId("move_guard_to_arm_body"), "Move Guard to Arm Body", |edit| { 44 ctx.add_assist(AssistId("move_guard_to_arm_body"), "Move guard to arm body", |edit| {
45 edit.target(guard.syntax().text_range()); 45 edit.target(guard.syntax().text_range());
46 let offseting_amount = match space_before_guard.and_then(|it| it.into_token()) { 46 let offseting_amount = match space_before_guard.and_then(|it| it.into_token()) {
47 Some(tok) => { 47 Some(tok) => {
@@ -111,7 +111,7 @@ pub(crate) fn move_arm_cond_to_match_guard(ctx: AssistCtx<impl HirDatabase>) ->
111 111
112 ctx.add_assist( 112 ctx.add_assist(
113 AssistId("move_arm_cond_to_match_guard"), 113 AssistId("move_arm_cond_to_match_guard"),
114 "move condition to match guard", 114 "Move condition to match guard",
115 |edit| { 115 |edit| {
116 edit.target(if_expr.syntax().text_range()); 116 edit.target(if_expr.syntax().text_range());
117 let then_only_expr = then_block.block().and_then(|it| it.statements().next()).is_none(); 117 let then_only_expr = then_block.block().and_then(|it| it.statements().next()).is_none();
diff --git a/crates/ra_assists/src/assists/raw_string.rs b/crates/ra_assists/src/assists/raw_string.rs
index 3583b636a..e79c51673 100644
--- a/crates/ra_assists/src/assists/raw_string.rs
+++ b/crates/ra_assists/src/assists/raw_string.rs
@@ -25,7 +25,7 @@ use crate::{Assist, AssistCtx, AssistId};
25pub(crate) fn make_raw_string(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 25pub(crate) fn make_raw_string(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
26 let token = ctx.find_token_at_offset(STRING).and_then(ast::String::cast)?; 26 let token = ctx.find_token_at_offset(STRING).and_then(ast::String::cast)?;
27 let value = token.value()?; 27 let value = token.value()?;
28 ctx.add_assist(AssistId("make_raw_string"), "Rewrite as Raw String", |edit| { 28 ctx.add_assist(AssistId("make_raw_string"), "Rewrite as raw string", |edit| {
29 edit.target(token.syntax().text_range()); 29 edit.target(token.syntax().text_range());
30 let max_hash_streak = count_hashes(&value); 30 let max_hash_streak = count_hashes(&value);
31 let mut hashes = String::with_capacity(max_hash_streak + 1); 31 let mut hashes = String::with_capacity(max_hash_streak + 1);
@@ -54,7 +54,7 @@ pub(crate) fn make_raw_string(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
54pub(crate) fn make_usual_string(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 54pub(crate) fn make_usual_string(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
55 let token = ctx.find_token_at_offset(RAW_STRING).and_then(ast::RawString::cast)?; 55 let token = ctx.find_token_at_offset(RAW_STRING).and_then(ast::RawString::cast)?;
56 let value = token.value()?; 56 let value = token.value()?;
57 ctx.add_assist(AssistId("make_usual_string"), "Rewrite as Regular String", |edit| { 57 ctx.add_assist(AssistId("make_usual_string"), "Rewrite as regular string", |edit| {
58 edit.target(token.syntax().text_range()); 58 edit.target(token.syntax().text_range());
59 // parse inside string to escape `"` 59 // parse inside string to escape `"`
60 let escaped = value.escape_default().to_string(); 60 let escaped = value.escape_default().to_string();
@@ -79,7 +79,7 @@ pub(crate) fn make_usual_string(ctx: AssistCtx<impl HirDatabase>) -> Option<Assi
79// ``` 79// ```
80pub(crate) fn add_hash(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 80pub(crate) fn add_hash(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
81 let token = ctx.find_token_at_offset(RAW_STRING)?; 81 let token = ctx.find_token_at_offset(RAW_STRING)?;
82 ctx.add_assist(AssistId("add_hash"), "Add # to Raw String", |edit| { 82 ctx.add_assist(AssistId("add_hash"), "Add # to raw string", |edit| {
83 edit.target(token.text_range()); 83 edit.target(token.text_range());
84 edit.insert(token.text_range().start() + TextUnit::of_char('r'), "#"); 84 edit.insert(token.text_range().start() + TextUnit::of_char('r'), "#");
85 edit.insert(token.text_range().end(), "#"); 85 edit.insert(token.text_range().end(), "#");
@@ -108,7 +108,7 @@ pub(crate) fn remove_hash(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
108 // no hash to remove 108 // no hash to remove
109 return None; 109 return None;
110 } 110 }
111 ctx.add_assist(AssistId("remove_hash"), "remove hash from raw string", |edit| { 111 ctx.add_assist(AssistId("remove_hash"), "Remove hash from raw string", |edit| {
112 edit.target(token.text_range()); 112 edit.target(token.text_range());
113 let result = &text[2..text.len() - 1]; 113 let result = &text[2..text.len() - 1];
114 let result = if result.starts_with('\"') { 114 let result = if result.starts_with('\"') {
diff --git a/crates/ra_assists/src/assists/replace_if_let_with_match.rs b/crates/ra_assists/src/assists/replace_if_let_with_match.rs
index dacbf8758..c9b62e5ff 100644
--- a/crates/ra_assists/src/assists/replace_if_let_with_match.rs
+++ b/crates/ra_assists/src/assists/replace_if_let_with_match.rs
@@ -42,7 +42,7 @@ pub(crate) fn replace_if_let_with_match(ctx: AssistCtx<impl HirDatabase>) -> Opt
42 ast::ElseBranch::IfExpr(_) => return None, 42 ast::ElseBranch::IfExpr(_) => return None,
43 }; 43 };
44 44
45 ctx.add_assist(AssistId("replace_if_let_with_match"), "Replace with Match", |edit| { 45 ctx.add_assist(AssistId("replace_if_let_with_match"), "Replace with match", |edit| {
46 let match_expr = build_match_expr(expr, pat, then_block, else_block); 46 let match_expr = build_match_expr(expr, pat, then_block, else_block);
47 edit.target(if_expr.syntax().text_range()); 47 edit.target(if_expr.syntax().text_range());
48 edit.replace_node_and_indent(if_expr.syntax(), match_expr); 48 edit.replace_node_and_indent(if_expr.syntax(), match_expr);
diff --git a/crates/ra_assists/src/assists/split_import.rs b/crates/ra_assists/src/assists/split_import.rs
index d36df069a..6038c4858 100644
--- a/crates/ra_assists/src/assists/split_import.rs
+++ b/crates/ra_assists/src/assists/split_import.rs
@@ -32,7 +32,7 @@ pub(crate) fn split_import(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
32 None => top_path.syntax().text_range().end(), 32 None => top_path.syntax().text_range().end(),
33 }; 33 };
34 34
35 ctx.add_assist(AssistId("split_import"), "Split Import", |edit| { 35 ctx.add_assist(AssistId("split_import"), "Split import", |edit| {
36 edit.target(colon_colon.text_range()); 36 edit.target(colon_colon.text_range());
37 edit.insert(l_curly, "{"); 37 edit.insert(l_curly, "{");
38 edit.insert(r_curly, "}"); 38 edit.insert(r_curly, "}");
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 712ff6f6a..150b34ac7 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -292,8 +292,11 @@ mod tests {
292 let assists = super::assists(&db, frange); 292 let assists = super::assists(&db, frange);
293 let mut assists = assists.iter(); 293 let mut assists = assists.iter();
294 294
295 assert_eq!(assists.next().expect("expected assist").0.label, "make pub(crate)"); 295 assert_eq!(
296 assert_eq!(assists.next().expect("expected assist").0.label, "add `#[derive]`"); 296 assists.next().expect("expected assist").0.label,
297 "Change visibility to pub(crate)"
298 );
299 assert_eq!(assists.next().expect("expected assist").0.label, "Add `#[derive]`");
297 } 300 }
298 301
299 #[test] 302 #[test]
@@ -312,7 +315,7 @@ mod tests {
312 let assists = super::assists(&db, frange); 315 let assists = super::assists(&db, frange);
313 let mut assists = assists.iter(); 316 let mut assists = assists.iter();
314 317
315 assert_eq!(assists.next().expect("expected assist").0.label, "introduce variable"); 318 assert_eq!(assists.next().expect("expected assist").0.label, "Extract into variable");
316 assert_eq!(assists.next().expect("expected assist").0.label, "replace with match"); 319 assert_eq!(assists.next().expect("expected assist").0.label, "Replace with match");
317 } 320 }
318} 321}