aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/add_derive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/add_derive.rs')
-rw-r--r--crates/ra_assists/src/add_derive.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_assists/src/add_derive.rs b/crates/ra_assists/src/add_derive.rs
index ea9707631..0556dd69c 100644
--- a/crates/ra_assists/src/add_derive.rs
+++ b/crates/ra_assists/src/add_derive.rs
@@ -7,10 +7,10 @@ use ra_syntax::{
7 7
8use crate::{AssistCtx, Assist}; 8use crate::{AssistCtx, Assist};
9 9
10pub(crate) fn add_derive(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let nominal = ctx.node_at_offset::<ast::NominalDef>()?; 11 let nominal = ctx.node_at_offset::<ast::NominalDef>()?;
12 let node_start = derive_insertion_offset(nominal)?; 12 let node_start = derive_insertion_offset(nominal)?;
13 ctx.build("add `#[derive]`", |edit| { 13 ctx.add_action("add `#[derive]`", |edit| {
14 let derive_attr = nominal 14 let derive_attr = nominal
15 .attrs() 15 .attrs()
16 .filter_map(|x| x.as_call()) 16 .filter_map(|x| x.as_call())
@@ -26,7 +26,9 @@ pub(crate) fn add_derive(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
26 }; 26 };
27 edit.target(nominal.syntax().range()); 27 edit.target(nominal.syntax().range());
28 edit.set_cursor(offset) 28 edit.set_cursor(offset)
29 }) 29 });
30
31 ctx.build()
30} 32}
31 33
32// Insert `derive` after doc comments. 34// Insert `derive` after doc comments.