aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir_def/src/find_path.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/find_path.rs b/crates/ra_hir_def/src/find_path.rs
index c7976535c..aee7e7511 100644
--- a/crates/ra_hir_def/src/find_path.rs
+++ b/crates/ra_hir_def/src/find_path.rs
@@ -17,18 +17,14 @@ const MAX_PATH_LEN: usize = 15;
17 17
18impl ModPath { 18impl ModPath {
19 fn starts_with_std(&self) -> bool { 19 fn starts_with_std(&self) -> bool {
20 self.segments.first().filter(|&first_segment| first_segment == &known::std).is_some() 20 self.segments.first() == Some(&known::std)
21 } 21 }
22 22
23 // When std library is present, paths starting with `std::` 23 // When std library is present, paths starting with `std::`
24 // should be preferred over paths starting with `core::` and `alloc::` 24 // should be preferred over paths starting with `core::` and `alloc::`
25 fn can_start_with_std(&self) -> bool { 25 fn can_start_with_std(&self) -> bool {
26 self.segments 26 let first_segment = self.segments.first();
27 .first() 27 first_segment == Some(&known::alloc) || first_segment == Some(&known::core)
28 .filter(|&first_segment| {
29 first_segment == &known::alloc || first_segment == &known::core
30 })
31 .is_some()
32 } 28 }
33 29
34 fn len(&self) -> usize { 30 fn len(&self) -> usize {