diff options
Diffstat (limited to 'crates/ra_hir_def/src/find_path.rs')
-rw-r--r-- | crates/ra_hir_def/src/find_path.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/find_path.rs b/crates/ra_hir_def/src/find_path.rs index f7dc8acb7..8cc2fb160 100644 --- a/crates/ra_hir_def/src/find_path.rs +++ b/crates/ra_hir_def/src/find_path.rs | |||
@@ -35,7 +35,7 @@ fn find_path_inner( | |||
35 | let def_map = db.crate_def_map(from.krate); | 35 | let def_map = db.crate_def_map(from.krate); |
36 | let from_scope: &crate::item_scope::ItemScope = &def_map.modules[from.local_id].scope; | 36 | let from_scope: &crate::item_scope::ItemScope = &def_map.modules[from.local_id].scope; |
37 | if let Some((name, _)) = from_scope.name_of(item) { | 37 | if let Some((name, _)) = from_scope.name_of(item) { |
38 | return Some(ModPath::from_simple_segments(PathKind::Plain, vec![name.clone()])); | 38 | return Some(ModPath::from_segments(PathKind::Plain, vec![name.clone()])); |
39 | } | 39 | } |
40 | 40 | ||
41 | // - if the item is the crate root, return `crate` | 41 | // - if the item is the crate root, return `crate` |
@@ -45,12 +45,12 @@ fn find_path_inner( | |||
45 | local_id: def_map.root, | 45 | local_id: def_map.root, |
46 | })) | 46 | })) |
47 | { | 47 | { |
48 | return Some(ModPath::from_simple_segments(PathKind::Crate, Vec::new())); | 48 | return Some(ModPath::from_segments(PathKind::Crate, Vec::new())); |
49 | } | 49 | } |
50 | 50 | ||
51 | // - if the item is the module we're in, use `self` | 51 | // - if the item is the module we're in, use `self` |
52 | if item == ItemInNs::Types(from.into()) { | 52 | if item == ItemInNs::Types(from.into()) { |
53 | return Some(ModPath::from_simple_segments(PathKind::Super(0), Vec::new())); | 53 | return Some(ModPath::from_segments(PathKind::Super(0), Vec::new())); |
54 | } | 54 | } |
55 | 55 | ||
56 | // - if the item is the parent module, use `super` (this is not used recursively, since `super::super` is ugly) | 56 | // - if the item is the parent module, use `super` (this is not used recursively, since `super::super` is ugly) |
@@ -61,14 +61,14 @@ fn find_path_inner( | |||
61 | local_id: parent_id, | 61 | local_id: parent_id, |
62 | })) | 62 | })) |
63 | { | 63 | { |
64 | return Some(ModPath::from_simple_segments(PathKind::Super(1), Vec::new())); | 64 | return Some(ModPath::from_segments(PathKind::Super(1), Vec::new())); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | // - if the item is the crate root of a dependency crate, return the name from the extern prelude | 68 | // - if the item is the crate root of a dependency crate, return the name from the extern prelude |
69 | for (name, def_id) in &def_map.extern_prelude { | 69 | for (name, def_id) in &def_map.extern_prelude { |
70 | if item == ItemInNs::Types(*def_id) { | 70 | if item == ItemInNs::Types(*def_id) { |
71 | return Some(ModPath::from_simple_segments(PathKind::Plain, vec![name.clone()])); | 71 | return Some(ModPath::from_segments(PathKind::Plain, vec![name.clone()])); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
@@ -79,7 +79,7 @@ fn find_path_inner( | |||
79 | &prelude_def_map.modules[prelude_module.local_id].scope; | 79 | &prelude_def_map.modules[prelude_module.local_id].scope; |
80 | if let Some((name, vis)) = prelude_scope.name_of(item) { | 80 | if let Some((name, vis)) = prelude_scope.name_of(item) { |
81 | if vis.is_visible_from(db, from) { | 81 | if vis.is_visible_from(db, from) { |
82 | return Some(ModPath::from_simple_segments(PathKind::Plain, vec![name.clone()])); | 82 | return Some(ModPath::from_segments(PathKind::Plain, vec![name.clone()])); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |