From 2619950b3b405324ab1c1745876165c834b3b4b9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 13 Dec 2019 12:12:36 +0100 Subject: Use different types for path with and without generics --- crates/ra_assists/src/assists/add_import.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'crates/ra_assists') 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( fn collect_hir_path_segments(path: &hir::Path) -> Option> { let mut ps = Vec::::with_capacity(10); - match path.kind { + match path.kind() { hir::PathKind::Abs => ps.push("".into()), hir::PathKind::Crate => ps.push("crate".into()), hir::PathKind::Plain => {} @@ -586,9 +586,7 @@ fn collect_hir_path_segments(path: &hir::Path) -> Option> { hir::PathKind::Super => ps.push("super".into()), hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None, } - for s in path.segments.iter() { - ps.push(s.name.to_string().into()); - } + ps.extend(path.segments().iter().map(|it| it.name.to_string().into())); Some(ps) } -- cgit v1.2.3