diff options
author | Aleksey Kladov <[email protected]> | 2019-12-13 11:12:36 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-14 18:15:40 +0000 |
commit | 2619950b3b405324ab1c1745876165c834b3b4b9 (patch) | |
tree | 1f32b3f34bbdad0d58b3cbddf250c350cd546de6 /crates/ra_assists | |
parent | f720855e1e45985463e31e0a6a2a76bb6ffd1cfa (diff) |
Use different types for path with and without generics
Diffstat (limited to 'crates/ra_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 | ||