1
Fork 0

Make ty::print::Printer take &mut self instead of self

This simplifies the code by removing all the `self` assignments and
makes the flow of data clearer - always into the printer.
Especially in v0 mangling, which already used  `&mut self` in some
places, it gets a lot more uniform.
This commit is contained in:
Nilstrieb 2023-10-17 19:46:14 +02:00
parent 45a45c6e60
commit 5acf26b97e
17 changed files with 615 additions and 592 deletions

View file

@ -298,9 +298,9 @@ fn fmt_instance(
ty::tls::with(|tcx| {
let args = tcx.lift(instance.args).expect("could not lift for printing");
let s = FmtPrinter::new_with_limit(tcx, Namespace::ValueNS, type_length)
.print_def_path(instance.def_id(), args)?
.into_buffer();
let mut cx = FmtPrinter::new_with_limit(tcx, Namespace::ValueNS, type_length);
cx.print_def_path(instance.def_id(), args)?;
let s = cx.into_buffer();
f.write_str(&s)
})?;