From a624e2ea8d6fc97df03f663581e082541fd0348f Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 11 Apr 2021 00:31:20 -0700 Subject: Adds impl Deref assist --- crates/ide_assists/src/tests/generated.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crates/ide_assists/src/tests') diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index 27a22ca10..41559b43a 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -551,6 +551,33 @@ impl Default for Example { ) } +#[test] +fn doctest_generate_deref() { + check_doc_test( + "generate_deref", + r#####" +struct A; +struct B { + $0a: A +} +"#####, + r#####" +struct A; +struct B { + a: A +} + +impl std::ops::Deref for B { + type Target = A; + + fn deref(&self) -> &Self::Target { + &self.a + } +} +"#####, + ) +} + #[test] fn doctest_generate_derive() { check_doc_test( -- cgit v1.2.3