Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/qualify_path.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/qualify_path.rs | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/crates/ide-assists/src/handlers/qualify_path.rs b/crates/ide-assists/src/handlers/qualify_path.rs index 5deb60f57b..8d2293d224 100644 --- a/crates/ide-assists/src/handlers/qualify_path.rs +++ b/crates/ide-assists/src/handlers/qualify_path.rs @@ -382,20 +382,6 @@ pub mod PubMod { } #[test] - fn not_applicable_in_import_statements() { - check_assist_not_applicable( - qualify_path, - r#" -use PubStruct$0; - -pub mod PubMod { - pub struct PubStruct; -} -"#, - ); - } - - #[test] fn qualify_function() { check_assist( qualify_path, @@ -1270,4 +1256,42 @@ struct Foo; "#, ); } + + #[test] + fn works_in_use_start() { + check_assist( + qualify_path, + 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::Foo; +"#, + ); + } + + #[test] + fn not_applicable_in_non_start_use() { + check_assist_not_applicable( + qualify_path, + r" +mod bar { + pub mod foo { + pub struct Foo; + } +} +use foo::Foo$0; +", + ); + } } |