aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_assists')
-rw-r--r--crates/ide_assists/src/handlers/qualify_path.rs37
1 files changed, 35 insertions, 2 deletions
diff --git a/crates/ide_assists/src/handlers/qualify_path.rs b/crates/ide_assists/src/handlers/qualify_path.rs
index 30b23da6c..40571e52b 100644
--- a/crates/ide_assists/src/handlers/qualify_path.rs
+++ b/crates/ide_assists/src/handlers/qualify_path.rs
@@ -208,8 +208,10 @@ fn label(candidate: &ImportCandidate, import: &LocatedImport) -> String {
208 format!("Qualify as `{}`", import.import_path) 208 format!("Qualify as `{}`", import.import_path)
209 } 209 }
210 } 210 }
211 ImportCandidate::TraitAssocItem(_) => format!("Qualify `{}`", import.import_path), 211 ImportCandidate::TraitAssocItem(_) => {
212 ImportCandidate::TraitMethod(_) => format!("Qualify with cast as `{}`", import.import_path), 212 format!("Qualify with `{}`", import.import_path)
213 }
214 ImportCandidate::TraitMethod(_) => format!("Qualify with `{}`", import.import_path),
213 } 215 }
214} 216}
215 217
@@ -544,6 +546,37 @@ fn main() {
544 } 546 }
545 547
546 #[test] 548 #[test]
549 fn associated_struct_const_unqualified() {
550 check_assist(
551 qualify_path,
552 r"
553 mod test_mod {
554 pub struct TestStruct {}
555 impl TestStruct {
556 const TEST_CONST: u8 = 42;
557 }
558 }
559
560 fn main() {
561 TEST_CONST$0
562 }
563 ",
564 r"
565 mod test_mod {
566 pub struct TestStruct {}
567 impl TestStruct {
568 const TEST_CONST: u8 = 42;
569 }
570 }
571
572 fn main() {
573 test_mod::TestStruct::TEST_CONST
574 }
575 ",
576 );
577 }
578
579 #[test]
547 fn associated_trait_function() { 580 fn associated_trait_function() {
548 check_assist( 581 check_assist(
549 qualify_path, 582 qualify_path,