ruff
10a1d9f0 - Unify `OldDiagnostic` and `Message` (#18391)

Commit
252 days ago
Unify `OldDiagnostic` and `Message` (#18391) Summary -- This PR unifies the remaining differences between `OldDiagnostic` and `Message` (`OldDiagnostic` was only missing an optional `noqa_offset` field) and replaces `Message` with `OldDiagnostic`. The biggest functional difference is that the combined `OldDiagnostic` kind no longer implements `AsRule` for an infallible conversion to `Rule`. This was pretty easy to work around with `is_some_and` and `is_none_or` in the few places it was needed. In `LintContext::report_diagnostic_if_enabled` we can just use the new `Violation::rule` method, which takes care of most cases. Most of the interesting changes are in [this range](https://github.com/astral-sh/ruff/pull/18391/files/8156992540f4e81f914a9534e99241b1e14382a1) before I started renaming. Test Plan -- Existing tests Future Work -- I think it's time to start shifting some of these fields to the new `Diagnostic` kind. I believe we want `Fix` for sure, but I'm less sure about the others. We may want to keep a thin wrapper type here anyway to implement a `rule` method, so we could leave some of these fields on that too.
Author
Parents
Loading