Skip to content

Commit

Permalink
use impl Trait argument instead of generic param for simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Feb 9, 2024
1 parent 7f871ab commit 97b4b7f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ struct Checker<'tcx> {
}

impl<'tcx> Checker<'tcx> {
fn check<F>(&self, trait_def_id: Option<DefId>, f: F) -> Result<(), ErrorGuaranteed>
where
F: FnOnce(TyCtxt<'tcx>, LocalDefId) -> Result<(), ErrorGuaranteed>,
{
fn check(
&self,
trait_def_id: Option<DefId>,
f: impl FnOnce(TyCtxt<'tcx>, LocalDefId) -> Result<(), ErrorGuaranteed>,
) -> Result<(), ErrorGuaranteed> {
if Some(self.trait_def_id) == trait_def_id { f(self.tcx, self.impl_def_id) } else { Ok(()) }
}
}
Expand Down

0 comments on commit 97b4b7f

Please sign in to comment.