ok/jj
1
0
Fork 0
forked from mirrors/jj

style: use .filter_map() instead of .flat_map() where appropriate

This commit is contained in:
Samuel Tardieu 2024-10-02 23:27:54 +02:00
parent 12f4d6d17b
commit 43711de61c
2 changed files with 2 additions and 1 deletions

View file

@ -134,6 +134,7 @@ testutils = { path = "lib/testutils" }
[workspace.lints.clippy]
explicit_iter_loop = "warn"
flat_map_option = "warn"
implicit_clone = "warn"
semicolon_if_nothing_returned = "warn"
uninlined_format_args = "warn"

View file

@ -297,7 +297,7 @@ impl FilesetExpression {
pub fn explicit_paths(&self) -> impl Iterator<Item = &RepoPath> {
// pre/post-ordering doesn't matter so long as children are visited from
// left to right.
self.dfs_pre().flat_map(|expr| match expr {
self.dfs_pre().filter_map(|expr| match expr {
FilesetExpression::Pattern(pattern) => pattern.as_path(),
_ => None,
})