aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r--crates/ra_hir/src/path.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 9fdfa0d13..2e42caffe 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -65,6 +65,14 @@ impl Path {
65 } 65 }
66 } 66 }
67 67
68 /// Converts an `ast::NameRef` into a single-identifier `Path`.
69 pub fn from_name_ref(name_ref: ast::NameRef) -> Path {
70 Path {
71 kind: PathKind::Plain,
72 segments: vec![name_ref.as_name()],
73 }
74 }
75
68 /// `true` is this path is a single identifier, like `foo` 76 /// `true` is this path is a single identifier, like `foo`
69 pub fn is_ident(&self) -> bool { 77 pub fn is_ident(&self) -> bool {
70 self.kind == PathKind::Plain && self.segments.len() == 1 78 self.kind == PathKind::Plain && self.segments.len() == 1