diff options
author | Aleksey Kladov <[email protected]> | 2020-05-19 15:45:57 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-19 15:45:57 +0100 |
commit | 908da9ac1b04a0eb27552ec9ca68a5f88c4f42c7 (patch) | |
tree | 9560be4a80cb7e9e0147450b6ff50ff3eb8043ab | |
parent | 5c9ebbeaa415a5ff811b3be5058d8cb374e9baac (diff) |
Simplify
-rw-r--r-- | crates/ra_hir_def/src/find_path.rs | 10 |
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 | ||
18 | impl ModPath { | 18 | impl 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 { |