From 5b2d52c8df5235fce9d2ae78adc3182a9659b268 Mon Sep 17 00:00:00 2001 From: Paulo Lieuthier Date: Sat, 19 Oct 2019 08:19:06 -0300 Subject: docs: describe new feature 'add custom impl for derived trait' --- crates/ra_assists/src/assists/add_custom_impl.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'crates/ra_assists/src/assists/add_custom_impl.rs') diff --git a/crates/ra_assists/src/assists/add_custom_impl.rs b/crates/ra_assists/src/assists/add_custom_impl.rs index 7e64cd902..037306fd6 100644 --- a/crates/ra_assists/src/assists/add_custom_impl.rs +++ b/crates/ra_assists/src/assists/add_custom_impl.rs @@ -12,6 +12,23 @@ use ra_syntax::{ const DERIVE_TRAIT: &'static str = "derive"; +// Assist: add_custom_impl +// +// Adds impl block for derived trait. +// +// ``` +// #[derive(Deb<|>ug, Display)] +// struct S; +// ``` +// -> +// ``` +// #[derive(Display)] +// struct S; +// +// impl Debug for S { +// +// } +// ``` pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option { let input = ctx.find_node_at_offset::()?; let attr = input.syntax().parent().and_then(ast::Attr::cast)?; -- cgit v1.2.3