aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-18 21:40:12 +0000
committerGitHub <[email protected]>2021-03-18 21:40:12 +0000
commit86878443b1789cac0e48177f5f2b95ad0d6e912c (patch)
tree2b08daf4f82f058a8ed27d29853bee1ec3c761fe /crates/ide_assists/src
parent48d6324a3f8a48efe3275424584a753c4e60d762 (diff)
parent34464ede3f57cbab4d6d1a67f36252cc22c02765 (diff)
Merge #8095
8095: Fix associated items not being appended to paths in import_assets r=SomeoneToIgnore a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_assists/src')
-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,