Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/auto_import.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/auto_import.rs | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/crates/ide-assists/src/handlers/auto_import.rs b/crates/ide-assists/src/handlers/auto_import.rs index 874563c6f7..0a0dafb35e 100644 --- a/crates/ide-assists/src/handlers/auto_import.rs +++ b/crates/ide-assists/src/handlers/auto_import.rs @@ -374,19 +374,6 @@ mod baz { } #[test] - fn not_applicable_in_import_statements() { - check_assist_not_applicable( - auto_import, - r" - use PubStruct$0; - - pub mod PubMod { - pub struct PubStruct; - }", - ); - } - - #[test] fn function_import() { check_assist( auto_import, @@ -1121,4 +1108,43 @@ struct Foo; "#, ); } + + #[test] + fn works_in_use_start() { + check_assist( + auto_import, + r#" +mod bar { + pub mod foo { + pub struct Foo; + } +} +use foo$0::Foo; +"#, + r#" +mod bar { + pub mod foo { + pub struct Foo; + } +} +use bar::foo; +use foo::Foo; +"#, + ); + } + + #[test] + fn not_applicable_in_non_start_use() { + check_assist_not_applicable( + auto_import, + r" +mod bar { + pub mod foo { + pub struct Foo; + } +} +use foo::Foo$0; +", + ); + } } |