diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 10:59:10 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 10:59:10 +0100 |
commit | 6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (patch) | |
tree | f19271365126259a7975dda9ee3e1e1496a299dd /crates/ra_assists/src/add_derive.rs | |
parent | 2830d1376b05794c7bf1467fe52ad3bc0eb4ca41 (diff) | |
parent | f3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d (diff) |
Merge #1560
1560: move debug_dump to fmt::Debug r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/add_derive.rs')
-rw-r--r-- | crates/ra_assists/src/add_derive.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/add_derive.rs b/crates/ra_assists/src/add_derive.rs index f19196f53..9c88644df 100644 --- a/crates/ra_assists/src/add_derive.rs +++ b/crates/ra_assists/src/add_derive.rs | |||
@@ -22,9 +22,9 @@ pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> | |||
22 | edit.insert(node_start, "#[derive()]\n"); | 22 | edit.insert(node_start, "#[derive()]\n"); |
23 | node_start + TextUnit::of_str("#[derive(") | 23 | node_start + TextUnit::of_str("#[derive(") |
24 | } | 24 | } |
25 | Some(tt) => tt.syntax().range().end() - TextUnit::of_char(')'), | 25 | Some(tt) => tt.syntax().text_range().end() - TextUnit::of_char(')'), |
26 | }; | 26 | }; |
27 | edit.target(nominal.syntax().range()); | 27 | edit.target(nominal.syntax().text_range()); |
28 | edit.set_cursor(offset) | 28 | edit.set_cursor(offset) |
29 | }); | 29 | }); |
30 | 30 | ||
@@ -37,7 +37,7 @@ fn derive_insertion_offset(nominal: &ast::NominalDef) -> Option<TextUnit> { | |||
37 | .syntax() | 37 | .syntax() |
38 | .children_with_tokens() | 38 | .children_with_tokens() |
39 | .find(|it| it.kind() != COMMENT && it.kind() != WHITESPACE)?; | 39 | .find(|it| it.kind() != COMMENT && it.kind() != WHITESPACE)?; |
40 | Some(non_ws_child.range().start()) | 40 | Some(non_ws_child.text_range().start()) |
41 | } | 41 | } |
42 | 42 | ||
43 | #[cfg(test)] | 43 | #[cfg(test)] |