Skip to content

Commit

Permalink
Simplify expression by unwrapping first
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosichert committed Jan 10, 2021
1 parent 92644e5 commit 04e7ae9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/file-source/src/paths_provider/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,16 @@ impl PathsProvider for Glob {
})?
.into_path();

let is_excluded = self.exclude_patterns.iter().any(|exclude_pattern| {
path.to_str()
.map_or(false, |path| exclude_pattern.matches(path))
let is_excluded = path.to_str().map_or(false, |path| {
self.exclude_patterns
.iter()
.any(|exclude_pattern| exclude_pattern.matches(path))
});

// Exclude all paths that match the list of our exclude patterns.
if is_excluded {
continue;
// Only include paths that does not match the list of our exclude patterns.
if !is_excluded {
paths.push(path);
}

paths.push(path);
}
}

Expand Down

0 comments on commit 04e7ae9

Please sign in to comment.