mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
use impl Trait
argument instead of generic param for simplicity
This commit is contained in:
parent
7f871ab9aa
commit
97b4b7f72b
@ -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…
Reference in New Issue
Block a user