From da0b348ae9f629c5cbe4a836a90ed85e36ca18e5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Jan 2019 11:28:42 +0300 Subject: migrate ra_hir to rowan 2.0 --- crates/ra_hir/src/path.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/path.rs') diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index dcf4cf8b6..6f0b0da97 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs @@ -18,14 +18,14 @@ pub enum PathKind { impl Path { /// Calls `cb` with all paths, represented by this use item. - pub fn expand_use_item(item: ast::UseItem, mut cb: impl FnMut(Path, Option)) { + pub fn expand_use_item(item: &ast::UseItem, mut cb: impl FnMut(Path, Option)) { if let Some(tree) = item.use_tree() { expand_use_tree(None, tree, &mut cb); } } /// Converts an `ast::Path` to `Path`. Works with use trees. - pub fn from_ast(mut path: ast::Path) -> Option { + pub fn from_ast(mut path: &ast::Path) -> Option { let mut kind = PathKind::Plain; let mut segments = Vec::new(); loop { @@ -53,7 +53,7 @@ impl Path { segments.reverse(); return Some(Path { kind, segments }); - fn qualifier(path: ast::Path) -> Option { + fn qualifier(path: &ast::Path) -> Option<&ast::Path> { if let Some(q) = path.qualifier() { return Some(q); } @@ -66,7 +66,7 @@ impl Path { } /// Converts an `ast::NameRef` into a single-identifier `Path`. - pub fn from_name_ref(name_ref: ast::NameRef) -> Path { + pub fn from_name_ref(name_ref: &ast::NameRef) -> Path { name_ref.as_name().into() } @@ -100,7 +100,7 @@ impl From for Path { fn expand_use_tree( prefix: Option, - tree: ast::UseTree, + tree: &ast::UseTree, cb: &mut impl FnMut(Path, Option), ) { if let Some(use_tree_list) = tree.use_tree_list() { @@ -146,7 +146,7 @@ fn expand_use_tree( } } -fn convert_path(prefix: Option, path: ast::Path) -> Option { +fn convert_path(prefix: Option, path: &ast::Path) -> Option { let prefix = if let Some(qual) = path.qualifier() { Some(convert_path(prefix, qual)?) } else { -- cgit v1.2.3