From e1d6981f90ba7852e949141dad0add855b57184a Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 25 Sep 2020 15:19:22 +0200 Subject: Don't unnecessarily unnest imports for import insertion --- .../src/handlers/add_missing_impl_members.rs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'crates/assists/src/handlers/add_missing_impl_members.rs') diff --git a/crates/assists/src/handlers/add_missing_impl_members.rs b/crates/assists/src/handlers/add_missing_impl_members.rs index 8df1d786b..1ac5fefd6 100644 --- a/crates/assists/src/handlers/add_missing_impl_members.rs +++ b/crates/assists/src/handlers/add_missing_impl_members.rs @@ -414,6 +414,41 @@ impl foo::Foo for S { ); } + #[test] + fn test_qualify_path_2() { + check_assist( + add_missing_impl_members, + r#" +mod foo { + pub mod bar { + pub struct Bar; + pub trait Foo { fn foo(&self, bar: Bar); } + } +} + +use foo::bar; + +struct S; +impl bar::Foo for S { <|> }"#, + r#" +mod foo { + pub mod bar { + pub struct Bar; + pub trait Foo { fn foo(&self, bar: Bar); } + } +} + +use foo::bar; + +struct S; +impl bar::Foo for S { + fn foo(&self, bar: bar::Bar) { + ${0:todo!()} + } +}"#, + ); + } + #[test] fn test_qualify_path_generic() { check_assist( -- cgit v1.2.3