From 908da9ac1b04a0eb27552ec9ca68a5f88c4f42c7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 19 May 2020 16:45:57 +0200 Subject: Simplify --- crates/ra_hir_def/src/find_path.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'crates') 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; impl ModPath { fn starts_with_std(&self) -> bool { - self.segments.first().filter(|&first_segment| first_segment == &known::std).is_some() + self.segments.first() == Some(&known::std) } // When std library is present, paths starting with `std::` // should be preferred over paths starting with `core::` and `alloc::` fn can_start_with_std(&self) -> bool { - self.segments - .first() - .filter(|&first_segment| { - first_segment == &known::alloc || first_segment == &known::core - }) - .is_some() + let first_segment = self.segments.first(); + first_segment == Some(&known::alloc) || first_segment == Some(&known::core) } fn len(&self) -> usize { -- cgit v1.2.3