mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Simplify
This commit is contained in:
parent
5c9ebbeaa4
commit
908da9ac1b
1 changed files with 3 additions and 7 deletions
|
@ -17,18 +17,14 @@ const MAX_PATH_LEN: usize = 15;
|
||||||
|
|
||||||
impl ModPath {
|
impl ModPath {
|
||||||
fn starts_with_std(&self) -> bool {
|
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::`
|
// When std library is present, paths starting with `std::`
|
||||||
// should be preferred over paths starting with `core::` and `alloc::`
|
// should be preferred over paths starting with `core::` and `alloc::`
|
||||||
fn can_start_with_std(&self) -> bool {
|
fn can_start_with_std(&self) -> bool {
|
||||||
self.segments
|
let first_segment = self.segments.first();
|
||||||
.first()
|
first_segment == Some(&known::alloc) || first_segment == Some(&known::core)
|
||||||
.filter(|&first_segment| {
|
|
||||||
first_segment == &known::alloc || first_segment == &known::core
|
|
||||||
})
|
|
||||||
.is_some()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn len(&self) -> usize {
|
fn len(&self) -> usize {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue