Simplify conditional erroring

This commit is contained in:
Oli Scherer 2024-02-09 20:23:18 +00:00
parent 4661c83530
commit 23277a502e

View file

@ -57,11 +57,7 @@ impl<'tcx> Checker<'tcx> {
where
F: FnMut(TyCtxt<'tcx>, LocalDefId) -> Result<(), ErrorGuaranteed>,
{
let mut res = Ok(());
if Some(self.trait_def_id) == trait_def_id {
res = res.and(f(self.tcx, self.impl_def_id));
}
res
if Some(self.trait_def_id) == trait_def_id { f(self.tcx, self.impl_def_id) } else { Ok(()) }
}
}