Remove type_name::AbsolutePathPrinter::comma_sep.

It's equivalent to the default `PrettyPrinter::comma_sep`.
This commit is contained in:
Nicholas Nethercote 2025-08-01 09:18:35 +10:00
parent bd0a308ca2
commit e7d6a0776b
2 changed files with 3 additions and 14 deletions

View file

@ -4,7 +4,7 @@ use rustc_data_structures::intern::Interned;
use rustc_hir::def_id::CrateNum;
use rustc_hir::definitions::DisambiguatedDefPathData;
use rustc_middle::bug;
use rustc_middle::ty::print::{PrettyPrinter, Print, PrintError, Printer};
use rustc_middle::ty::print::{PrettyPrinter, PrintError, Printer};
use rustc_middle::ty::{self, GenericArg, GenericArgKind, Ty, TyCtxt};
struct AbsolutePathPrinter<'tcx> {
@ -138,19 +138,6 @@ impl<'tcx> PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> {
fn should_print_region(&self, _region: ty::Region<'_>) -> bool {
false
}
fn comma_sep<T>(&mut self, mut elems: impl Iterator<Item = T>) -> Result<(), PrintError>
where
T: Print<'tcx, Self>,
{
if let Some(first) = elems.next() {
first.print(self)?;
for elem in elems {
self.path.push_str(", ");
elem.print(self)?;
}
}
Ok(())
}
fn generic_delimiters(
&mut self,

View file

@ -460,6 +460,8 @@ impl<'tcx> PrettyPrinter<'tcx> for SymbolPrinter<'tcx> {
fn should_print_region(&self, _region: ty::Region<'_>) -> bool {
false
}
// Identical to `PrettyPrinter::comma_sep` except there is no space after each comma.
fn comma_sep<T>(&mut self, mut elems: impl Iterator<Item = T>) -> Result<(), PrintError>
where
T: Print<'tcx, Self>,