aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/find_path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/find_path.rs')
-rw-r--r--crates/hir_def/src/find_path.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_def/src/find_path.rs b/crates/hir_def/src/find_path.rs
index 94a1d567d..aa2c6e04e 100644
--- a/crates/hir_def/src/find_path.rs
+++ b/crates/hir_def/src/find_path.rs
@@ -36,13 +36,13 @@ const MAX_PATH_LEN: usize = 15;
36 36
37impl ModPath { 37impl ModPath {
38 fn starts_with_std(&self) -> bool { 38 fn starts_with_std(&self) -> bool {
39 self.segments.first() == Some(&known::std) 39 self.segments().first() == Some(&known::std)
40 } 40 }
41 41
42 // When std library is present, paths starting with `std::` 42 // When std library is present, paths starting with `std::`
43 // should be preferred over paths starting with `core::` and `alloc::` 43 // should be preferred over paths starting with `core::` and `alloc::`
44 fn can_start_with_std(&self) -> bool { 44 fn can_start_with_std(&self) -> bool {
45 let first_segment = self.segments.first(); 45 let first_segment = self.segments().first();
46 first_segment == Some(&known::alloc) || first_segment == Some(&known::core) 46 first_segment == Some(&known::alloc) || first_segment == Some(&known::core)
47 } 47 }
48} 48}
@@ -157,7 +157,7 @@ fn find_path_inner(
157 if let Some(ModuleDefId::EnumVariantId(variant)) = item.as_module_def_id() { 157 if let Some(ModuleDefId::EnumVariantId(variant)) = item.as_module_def_id() {
158 if let Some(mut path) = find_path(db, ItemInNs::Types(variant.parent.into()), from) { 158 if let Some(mut path) = find_path(db, ItemInNs::Types(variant.parent.into()), from) {
159 let data = db.enum_data(variant.parent); 159 let data = db.enum_data(variant.parent);
160 path.segments.push(data.variants[variant.local_id].name.clone()); 160 path.push_segment(data.variants[variant.local_id].name.clone());
161 return Some(path); 161 return Some(path);
162 } 162 }
163 // If this doesn't work, it seems we have no way of referring to the 163 // If this doesn't work, it seems we have no way of referring to the
@@ -186,7 +186,7 @@ fn find_path_inner(
186 best_path_len - 1, 186 best_path_len - 1,
187 prefixed, 187 prefixed,
188 ) { 188 ) {
189 path.segments.push(name); 189 path.push_segment(name);
190 190
191 let new_path = if let Some(best_path) = best_path { 191 let new_path = if let Some(best_path) = best_path {
192 select_best_path(best_path, path, prefer_no_std) 192 select_best_path(best_path, path, prefer_no_std)
@@ -215,7 +215,7 @@ fn find_path_inner(
215 prefixed, 215 prefixed,
216 )?; 216 )?;
217 mark::hit!(partially_imported); 217 mark::hit!(partially_imported);
218 path.segments.push(info.path.segments.last().unwrap().clone()); 218 path.push_segment(info.path.segments.last().unwrap().clone());
219 Some(path) 219 Some(path)
220 }) 220 })
221 }); 221 });