aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-17 14:39:07 +0000
committerGitHub <[email protected]>2019-12-17 14:39:07 +0000
commitb90f9e6d594584ab003a33142bb2193aea6f8bcd (patch)
tree05d3cf8ec0fcca490ffbac1534d3a08c2eeb854c /crates/ra_assists
parentf51a3fed9f8227a2b3bc8521b529cb9734ff0e7e (diff)
parentaca022f1d49a6d945f3ef4f8c781d7337120b68d (diff)
Merge #2581
2581: Refactor PathKind r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists')
-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()));