Skip to content

Commit 908da9a

Browse files
committed
Simplify
1 parent 5c9ebbe commit 908da9a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

crates/ra_hir_def/src/find_path.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ const MAX_PATH_LEN: usize = 15;
1717

1818
impl ModPath {
1919
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)
2121
}
2222

2323
// When std library is present, paths starting with `std::`
2424
// should be preferred over paths starting with `core::` and `alloc::`
2525
fn can_start_with_std(&self) -> bool {
26-
self.segments
27-
.first()
28-
.filter(|&first_segment| {
29-
first_segment == &known::alloc || first_segment == &known::core
30-
})
31-
.is_some()
26+
let first_segment = self.segments.first();
27+
first_segment == Some(&known::alloc) || first_segment == Some(&known::core)
3228
}
3329

3430
fn len(&self) -> usize {

0 commit comments

Comments
 (0)