aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 18:57:33 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 18:57:33 +0100
commitfabd4c4304e387ed6bcc29b39d1593666c4cbec9 (patch)
treeb18a0be7255bb070dd7e2ae3b5687bc5f35f0d41 /crates/ra_assists
parentd4ffbf2ae092b313b3c750adad398f3aa6fb209b (diff)
parent002529937075bd69d7f71483d798d6e4f43d1de9 (diff)
Merge #1556
1556: sane indexing in text r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/remove_dbg.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/remove_dbg.rs
index c330bc827..5657ee4b8 100644
--- a/crates/ra_assists/src/remove_dbg.rs
+++ b/crates/ra_assists/src/remove_dbg.rs
@@ -36,11 +36,10 @@ pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist>
36 36
37 let macro_content = { 37 let macro_content = {
38 let macro_args = macro_call.token_tree()?.syntax().clone(); 38 let macro_args = macro_call.token_tree()?.syntax().clone();
39 let range = macro_args.range();
40 let start = range.start() + TextUnit::of_char('(');
41 let end = range.end() - TextUnit::of_char(')');
42 39
43 macro_args.text().slice(start..end).to_string() 40 let text = macro_args.text();
41 let without_parens = TextUnit::of_char('(')..text.len() - TextUnit::of_char(')');
42 text.slice(without_parens).to_string()
44 }; 43 };
45 44
46 ctx.add_action(AssistId("remove_dbg"), "remove dbg!()", |edit| { 45 ctx.add_action(AssistId("remove_dbg"), "remove dbg!()", |edit| {