diff options
author | Aleksey Kladov <[email protected]> | 2019-07-19 18:55:32 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 18:55:32 +0100 |
commit | 002529937075bd69d7f71483d798d6e4f43d1de9 (patch) | |
tree | b18a0be7255bb070dd7e2ae3b5687bc5f35f0d41 /crates/ra_assists/src | |
parent | 8467ba8cdb565d865e14e2115cde98cd7692719d (diff) |
sane indexing in text
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/remove_dbg.rs | 7 |
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| { |