diff options
| author | Johann Hemmann <johann.hemmann@code.berlin> | 2024-01-19 14:54:07 +0100 |
|---|---|---|
| committer | Johann Hemmann <johann.hemmann@code.berlin> | 2024-01-19 17:31:01 +0100 |
| commit | c27b6b53089a31c358c9e565218f0796444d39cd (patch) | |
| tree | 1cbf54db0602e31914a5b345f09ebfa9e4771526 | |
| parent | 575398134ebd1f3f0a2137f85a16849050652d40 (diff) | |
| download | rust-c27b6b53089a31c358c9e565218f0796444d39cd.tar.gz rust-c27b6b53089a31c358c9e565218f0796444d39cd.zip | |
filter_map_bool_then
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/hir-def/src/generics.rs | 10 |
2 files changed, 4 insertions, 7 deletions
diff --git a/Cargo.toml b/Cargo.toml index 119b94bdc76..9fd58325368 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -174,7 +174,6 @@ derived_hash_with_manual_eq = "allow" field_reassign_with_default = "allow" forget_non_drop = "allow" format_collect = "allow" -filter_map_bool_then = "allow" if_same_then_else = "allow" large_enum_variant = "allow" match_like_matches_macro = "allow" diff --git a/crates/hir-def/src/generics.rs b/crates/hir-def/src/generics.rs index 6cb9b8448d1..7daae821f88 100644 --- a/crates/hir-def/src/generics.rs +++ b/crates/hir-def/src/generics.rs @@ -400,9 +400,8 @@ impl GenericParams { params .type_or_consts .iter() - .filter_map(|(idx, param)| { - enabled(idx.into()).then(|| param.clone()) - }) + .filter(|(idx, _)| enabled((*idx).into())) + .map(|(_, param)| param.clone()) .collect() }), lifetimes: all_lifetimes_enabled @@ -411,9 +410,8 @@ impl GenericParams { params .lifetimes .iter() - .filter_map(|(idx, param)| { - enabled(idx.into()).then(|| param.clone()) - }) + .filter(|(idx, _)| enabled((*idx).into())) + .map(|(_, param)| param.clone()) .collect() }), where_predicates: params.where_predicates.clone(), |
