Avoid some code duplication.
`print_binder` can call `wrap_binder`.
This commit is contained in:
@@ -2437,12 +2437,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
|
|||||||
where
|
where
|
||||||
T: Print<'tcx, Self> + TypeFoldable<TyCtxt<'tcx>>,
|
T: Print<'tcx, Self> + TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
let old_region_index = self.region_index;
|
self.wrap_binder(value, WrapBinderMode::ForAll, |new_value, this| new_value.print(this))
|
||||||
let (new_value, _) = self.name_all_regions(value, WrapBinderMode::ForAll)?;
|
|
||||||
new_value.print(self)?;
|
|
||||||
self.region_index = old_region_index;
|
|
||||||
self.binder_depth -= 1;
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap_binder<T, C: FnOnce(&T, &mut Self) -> Result<(), PrintError>>(
|
fn wrap_binder<T, C: FnOnce(&T, &mut Self) -> Result<(), PrintError>>(
|
||||||
|
|||||||
Reference in New Issue
Block a user