aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/assists/remove_dbg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/assists/remove_dbg.rs')
-rw-r--r--crates/ra_assists/src/assists/remove_dbg.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_assists/src/assists/remove_dbg.rs b/crates/ra_assists/src/assists/remove_dbg.rs
index 44b8de814..aedf8747f 100644
--- a/crates/ra_assists/src/assists/remove_dbg.rs
+++ b/crates/ra_assists/src/assists/remove_dbg.rs
@@ -21,7 +21,7 @@ use crate::{Assist, AssistCtx, AssistId};
21// 92; 21// 92;
22// } 22// }
23// ``` 23// ```
24pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 24pub(crate) fn remove_dbg(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
25 let macro_call = ctx.find_node_at_offset::<ast::MacroCall>()?; 25 let macro_call = ctx.find_node_at_offset::<ast::MacroCall>()?;
26 26
27 if !is_valid_macrocall(&macro_call, "dbg")? { 27 if !is_valid_macrocall(&macro_call, "dbg")? {
@@ -58,13 +58,11 @@ pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist>
58 text.slice(without_parens).to_string() 58 text.slice(without_parens).to_string()
59 }; 59 };
60 60
61 ctx.add_action(AssistId("remove_dbg"), "remove dbg!()", |edit| { 61 ctx.add_assist(AssistId("remove_dbg"), "remove dbg!()", |edit| {
62 edit.target(macro_call.syntax().text_range()); 62 edit.target(macro_call.syntax().text_range());
63 edit.replace(macro_range, macro_content); 63 edit.replace(macro_range, macro_content);
64 edit.set_cursor(cursor_pos); 64 edit.set_cursor(cursor_pos);
65 }); 65 })
66
67 ctx.build()
68} 66}
69 67
70/// Verifies that the given macro_call actually matches the given name 68/// Verifies that the given macro_call actually matches the given name