mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Fix: prefer the usage of for
loops over fold
This commit is contained in:
parent
0e480a6e9c
commit
27605b402e
1 changed files with 8 additions and 9 deletions
|
@ -161,16 +161,15 @@ impl Directories {
|
||||||
/// - This path is longer than any element in `self.exclude` that is a prefix
|
/// - This path is longer than any element in `self.exclude` that is a prefix
|
||||||
/// of `path`. In case of equality, exclusion wins.
|
/// of `path`. In case of equality, exclusion wins.
|
||||||
fn includes_path(&self, path: &AbsPath) -> bool {
|
fn includes_path(&self, path: &AbsPath) -> bool {
|
||||||
let include = self.include.iter().fold(None::<&AbsPathBuf>, |include, incl| {
|
let mut include = None::<&AbsPathBuf>;
|
||||||
if !path.starts_with(incl) {
|
for incl in &self.include {
|
||||||
return include;
|
if path.starts_with(incl) {
|
||||||
|
include = Some(match include {
|
||||||
|
Some(prev) if prev.starts_with(incl) => prev,
|
||||||
|
_ => incl,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Some(match include {
|
|
||||||
Some(prev) if prev.starts_with(incl) => prev,
|
|
||||||
_ => incl,
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
let include = match include {
|
let include = match include {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
|
|
Loading…
Reference in a new issue