aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-17 14:38:28 +0000
committerAleksey Kladov <[email protected]>2019-12-17 14:38:28 +0000
commitaca022f1d49a6d945f3ef4f8c781d7337120b68d (patch)
tree4cddf22d75fc1a9a3e8ff2863a1983348f193b26 /crates/ra_assists/src
parent4a58522119955f36d95212be902fe3ab79c5e922 (diff)
Refactor PathKind
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/assists/add_import.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/add_import.rs b/crates/ra_assists/src/assists/add_import.rs
index f81b4184a..ceffee9b8 100644
--- a/crates/ra_assists/src/assists/add_import.rs
+++ b/crates/ra_assists/src/assists/add_import.rs
@@ -582,8 +582,14 @@ fn collect_hir_path_segments(path: &hir::Path) -> Option<Vec<SmolStr>> {
582 hir::PathKind::Abs => ps.push("".into()), 582 hir::PathKind::Abs => ps.push("".into()),
583 hir::PathKind::Crate => ps.push("crate".into()), 583 hir::PathKind::Crate => ps.push("crate".into()),
584 hir::PathKind::Plain => {} 584 hir::PathKind::Plain => {}
585 hir::PathKind::Self_ => ps.push("self".into()), 585 hir::PathKind::Super(0) => ps.push("self".into()),
586 hir::PathKind::Super => ps.push("super".into()), 586 hir::PathKind::Super(lvl) => {
587 let mut chain = "super".to_string();
588 for _ in 0..*lvl {
589 chain += "::super";
590 }
591 ps.push(chain.into());
592 }
587 hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None, 593 hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None,
588 } 594 }
589 ps.extend(path.segments().iter().map(|it| it.name.to_string().into())); 595 ps.extend(path.segments().iter().map(|it| it.name.to_string().into()));