mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
remove unnecessary lazy evaluations
This commit is contained in:
parent
7530d76f00
commit
cc80c5bd07
31 changed files with 50 additions and 51 deletions
|
@ -37,7 +37,7 @@ fn eval_goal(ra_fixture: &str, minicore: &str) -> Result<Layout, LayoutError> {
|
|||
hir_def::AdtId::UnionId(x) => db.union_data(x).name.to_smol_str(),
|
||||
hir_def::AdtId::EnumId(x) => db.enum_data(x).name.to_smol_str(),
|
||||
};
|
||||
(name == "Goal").then(|| x)
|
||||
(name == "Goal").then_some(x)
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
|
|
|
@ -714,7 +714,7 @@ fn lookup_impl_assoc_item_for_trait_ref(
|
|||
let impl_data = find_matching_impl(impls, table, trait_ref)?;
|
||||
impl_data.items.iter().find_map(|it| match it {
|
||||
AssocItemId::FunctionId(f) => {
|
||||
(db.function_data(*f).name == *name).then(|| AssocItemId::FunctionId(*f))
|
||||
(db.function_data(*f).name == *name).then_some(AssocItemId::FunctionId(*f))
|
||||
}
|
||||
AssocItemId::ConstId(c) => db
|
||||
.const_data(*c)
|
||||
|
|
|
@ -61,7 +61,7 @@ impl TraitEnvironment {
|
|||
) -> impl Iterator<Item = TraitId> + 'a {
|
||||
self.traits_from_clauses
|
||||
.iter()
|
||||
.filter_map(move |(self_ty, trait_id)| (*self_ty == ty).then(|| *trait_id))
|
||||
.filter_map(move |(self_ty, trait_id)| (*self_ty == ty).then_some(*trait_id))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue