use impl Trait
argument instead of generic param for simplicity
This commit is contained in:
parent
7f871ab9aa
commit
97b4b7f72b
1 changed files with 5 additions and 4 deletions
|
@ -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(()) }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue