Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/generics.rs')
| -rw-r--r-- | crates/hir-def/src/generics.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crates/hir-def/src/generics.rs b/crates/hir-def/src/generics.rs index 58ac86e8a6..71fb253c87 100644 --- a/crates/hir-def/src/generics.rs +++ b/crates/hir-def/src/generics.rs @@ -329,26 +329,30 @@ impl GenericParams { params.clone() } else { Arc::new(GenericParams { - type_or_consts: all_type_or_consts_enabled - .then(|| params.type_or_consts.clone()) - .unwrap_or_else(|| { + type_or_consts: if all_type_or_consts_enabled { + params.type_or_consts.clone() + } else { + { params .type_or_consts .iter() .filter(|&(idx, _)| enabled(attr_owner_ct(idx))) .map(|(_, param)| param.clone()) .collect() - }), - lifetimes: all_lifetimes_enabled - .then(|| params.lifetimes.clone()) - .unwrap_or_else(|| { + } + }, + lifetimes: if all_lifetimes_enabled { + params.lifetimes.clone() + } else { + { params .lifetimes .iter() .filter(|&(idx, _)| enabled(attr_owner_lt(idx))) .map(|(_, param)| param.clone()) .collect() - }), + } + }, where_predicates: params.where_predicates.clone(), types_map: params.types_map.clone(), }) |