diff options
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/generate_derive.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/generate_impl.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/generate_derive.rs b/crates/ra_assists/src/handlers/generate_derive.rs index 6ccf39900..90ece9fab 100644 --- a/crates/ra_assists/src/handlers/generate_derive.rs +++ b/crates/ra_assists/src/handlers/generate_derive.rs | |||
@@ -26,7 +26,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
26 | // ``` | 26 | // ``` |
27 | pub(crate) fn generate_derive(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 27 | pub(crate) fn generate_derive(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
28 | let cap = ctx.config.snippet_cap?; | 28 | let cap = ctx.config.snippet_cap?; |
29 | let nominal = ctx.find_node_at_offset::<ast::NominalDef>()?; | 29 | let nominal = ctx.find_node_at_offset::<ast::AdtDef>()?; |
30 | let node_start = derive_insertion_offset(&nominal)?; | 30 | let node_start = derive_insertion_offset(&nominal)?; |
31 | let target = nominal.syntax().text_range(); | 31 | let target = nominal.syntax().text_range(); |
32 | acc.add( | 32 | acc.add( |
@@ -58,7 +58,7 @@ pub(crate) fn generate_derive(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
58 | } | 58 | } |
59 | 59 | ||
60 | // Insert `derive` after doc comments. | 60 | // Insert `derive` after doc comments. |
61 | fn derive_insertion_offset(nominal: &ast::NominalDef) -> Option<TextSize> { | 61 | fn derive_insertion_offset(nominal: &ast::AdtDef) -> Option<TextSize> { |
62 | let non_ws_child = nominal | 62 | let non_ws_child = nominal |
63 | .syntax() | 63 | .syntax() |
64 | .children_with_tokens() | 64 | .children_with_tokens() |
diff --git a/crates/ra_assists/src/handlers/generate_impl.rs b/crates/ra_assists/src/handlers/generate_impl.rs index cbbac1d7f..42eb4defa 100644 --- a/crates/ra_assists/src/handlers/generate_impl.rs +++ b/crates/ra_assists/src/handlers/generate_impl.rs | |||
@@ -23,7 +23,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
23 | // } | 23 | // } |
24 | // ``` | 24 | // ``` |
25 | pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 25 | pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
26 | let nominal = ctx.find_node_at_offset::<ast::NominalDef>()?; | 26 | let nominal = ctx.find_node_at_offset::<ast::AdtDef>()?; |
27 | let name = nominal.name()?; | 27 | let name = nominal.name()?; |
28 | let target = nominal.syntax().text_range(); | 28 | let target = nominal.syntax().text_range(); |
29 | acc.add( | 29 | acc.add( |