diff options
Diffstat (limited to 'crates/hir_def/src/path.rs')
-rw-r--r-- | crates/hir_def/src/path.rs | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index d9ec03d2d..16440041d 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs | |||
@@ -14,10 +14,7 @@ use hir_expand::{ | |||
14 | }; | 14 | }; |
15 | use syntax::ast; | 15 | use syntax::ast; |
16 | 16 | ||
17 | use crate::{ | 17 | use crate::type_ref::{TypeBound, TypeRef}; |
18 | type_ref::{TypeBound, TypeRef}, | ||
19 | InFile, | ||
20 | }; | ||
21 | 18 | ||
22 | #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] | 19 | #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
23 | pub struct ModPath { | 20 | pub struct ModPath { |
@@ -56,8 +53,7 @@ impl Display for ImportAlias { | |||
56 | 53 | ||
57 | impl ModPath { | 54 | impl ModPath { |
58 | pub fn from_src(db: &dyn DefDatabase, path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { | 55 | pub fn from_src(db: &dyn DefDatabase, path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { |
59 | let ctx = LowerCtx::with_hygiene(db, hygiene); | 56 | lower::convert_path(db, None, path, hygiene) |
60 | lower::lower_path(path, &ctx).map(|it| (*it.mod_path).clone()) | ||
61 | } | 57 | } |
62 | 58 | ||
63 | pub fn from_segments(kind: PathKind, segments: impl IntoIterator<Item = Name>) -> ModPath { | 59 | pub fn from_segments(kind: PathKind, segments: impl IntoIterator<Item = Name>) -> ModPath { |
@@ -70,18 +66,6 @@ impl ModPath { | |||
70 | ModPath { kind, segments: Vec::new() } | 66 | ModPath { kind, segments: Vec::new() } |
71 | } | 67 | } |
72 | 68 | ||
73 | /// Calls `cb` with all paths, represented by this use item. | ||
74 | pub fn expand_use_item( | ||
75 | db: &dyn DefDatabase, | ||
76 | item_src: InFile<ast::Use>, | ||
77 | hygiene: &Hygiene, | ||
78 | mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<ImportAlias>), | ||
79 | ) { | ||
80 | if let Some(tree) = item_src.value.use_tree() { | ||
81 | lower::lower_use_tree(db, None, tree, hygiene, &mut cb); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | pub fn segments(&self) -> &[Name] { | 69 | pub fn segments(&self) -> &[Name] { |
86 | &self.segments | 70 | &self.segments |
87 | } | 71 | } |