diff options
Diffstat (limited to 'crates/ra_assists/src')
-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 | ||