Customize where the `fix_title` sub-diagnostic appears (#23044)
Summary
--
This is a more general alternative to #23043 that more closely follows
Micha's
[suggestion]. I sort of prefer this approach because it gives the
diagnostic
author full control of the order of sub-diagnostics. On the other hand,
it feels
a bit too "clever" for the current usage, which achieves the same effect
as the
simpler #23043. So I'm curious to get others' thoughts.
I still think the ideal solution long-term would be to combine the diff
rendering with the sub-diagnostic holding the fix title, but that would
be much
more involved than either of these PRs.
As I noted in the summary for #23043, the main motivation for the defer
machinery is that [RUF064] has a bunch of early returns mixed in with
its `info`
additions, so it was a big pain to add a `help` diagnostic before each
return.
We may at least want a `deferred_help` helper instead of the closure
used
here, if we do take this approach.
[suggestion]:
https://github.com/astral-sh/ruff/pull/19900/changes/BASE..ab685c16a8c01bb33f054698d2f32bb023d07429#r2276500131
[RUF064]:
https://github.com/astral-sh/ruff/blob/4a32a96740bb7327a3f554b7f6d6675cb2ea797e/crates/ruff_linter/src/rules/ruff/rules/non_octal_permissions.rs#L120-L145
Test Plan
--
Updated snapshots for `RUF064` and `ISC004`.