diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-14 18:16:48 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-14 18:16:48 +0000 |
commit | d6223253b628b279f9ddae8f83f7173d01f6b32c (patch) | |
tree | 12f2ccc5c52c1c0b67932d3a35fe18668b8e5d62 /crates/ra_assists/src/assists | |
parent | 202ad1e2d9376565cb273cf085be600ed10e5a93 (diff) | |
parent | 2619950b3b405324ab1c1745876165c834b3b4b9 (diff) |
Merge #2561
2561: Split generic and non-generic paths r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r-- | crates/ra_assists/src/assists/add_import.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_assists/src/assists/add_import.rs b/crates/ra_assists/src/assists/add_import.rs index 363ade016..f81b4184a 100644 --- a/crates/ra_assists/src/assists/add_import.rs +++ b/crates/ra_assists/src/assists/add_import.rs | |||
@@ -578,7 +578,7 @@ fn apply_auto_import( | |||
578 | 578 | ||
579 | fn collect_hir_path_segments(path: &hir::Path) -> Option<Vec<SmolStr>> { | 579 | fn collect_hir_path_segments(path: &hir::Path) -> Option<Vec<SmolStr>> { |
580 | let mut ps = Vec::<SmolStr>::with_capacity(10); | 580 | let mut ps = Vec::<SmolStr>::with_capacity(10); |
581 | match path.kind { | 581 | match path.kind() { |
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 => {} |
@@ -586,9 +586,7 @@ fn collect_hir_path_segments(path: &hir::Path) -> Option<Vec<SmolStr>> { | |||
586 | hir::PathKind::Super => ps.push("super".into()), | 586 | hir::PathKind::Super => ps.push("super".into()), |
587 | hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None, | 587 | hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None, |
588 | } | 588 | } |
589 | for s in path.segments.iter() { | 589 | ps.extend(path.segments().iter().map(|it| it.name.to_string().into())); |
590 | ps.push(s.name.to_string().into()); | ||
591 | } | ||
592 | Some(ps) | 590 | Some(ps) |
593 | } | 591 | } |
594 | 592 | ||