diff options
Diffstat (limited to 'crates/ra_assists/src/add_derive.rs')
-rw-r--r-- | crates/ra_assists/src/add_derive.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_assists/src/add_derive.rs b/crates/ra_assists/src/add_derive.rs index e91b5eb8d..0c4cf2615 100644 --- a/crates/ra_assists/src/add_derive.rs +++ b/crates/ra_assists/src/add_derive.rs | |||
@@ -33,8 +33,10 @@ pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> | |||
33 | 33 | ||
34 | // Insert `derive` after doc comments. | 34 | // Insert `derive` after doc comments. |
35 | fn derive_insertion_offset(nominal: &ast::NominalDef) -> Option<TextUnit> { | 35 | fn derive_insertion_offset(nominal: &ast::NominalDef) -> Option<TextUnit> { |
36 | let non_ws_child = | 36 | let non_ws_child = nominal |
37 | nominal.syntax().children().find(|it| it.kind() != COMMENT && it.kind() != WHITESPACE)?; | 37 | .syntax() |
38 | .children_with_tokens() | ||
39 | .find(|it| it.kind() != COMMENT && it.kind() != WHITESPACE)?; | ||
38 | Some(non_ws_child.range().start()) | 40 | Some(non_ws_child.range().start()) |
39 | } | 41 | } |
40 | 42 | ||