[rustdoc] Replace print methods with functions to improve code readability by GuillaumeGomez · Pull Request #148585 · rust-lang/rust (original) (raw)
I dunno, personally, I kinda prefer the method scheme over free fns. term.print() is better than print_term(term), IMHO. But then again, not all the calls to print are on a receiver that's named so descriptively.
So 🤷
If it's more consistent with the rest of the codebase, then yeah, it's probably a good change.
I do think that it's a bit too many commits though? Maybe squash 'em down into one (or more than one if you can find a logical way to group some of the changed items together?)
On an unrelated note, I wish there was a nice way to reduce all the impl Display boilerplate, e.g. something like:
#[display_fn] fn print_term(term: ..., f: &mut Formatter) -> fmt::Result { // ... }
and that would be expanded into a fn print_term(term: ...) -> impl Display.
But I really don't like the idea of a macro changing an fn's signature, sounds very confusing.