ruff/crates/ruff_macros/src
Brent Westbrook 10a1d9f01e
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](8156992540)
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.
2025-06-19 09:37:58 -04:00
..
cache_key.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
combine.rs Add knot.toml schema (#15735) 2025-02-07 10:59:40 +01:00
combine_options.rs Use `#[expect(lint)]` over `#[allow(lint)]` where possible (#17822) 2025-05-03 21:20:31 +02:00
config.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
derive_message_formats.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
kebab_case.rs Inline `DiagnosticKind` into other diagnostic types (#18074) 2025-05-15 10:27:21 -04:00
lib.rs [ty] Allow overriding rules for specific files (#18648) 2025-06-15 14:27:39 +01:00
map_codes.rs Unify `OldDiagnostic` and `Message` (#18391) 2025-06-19 09:37:58 -04:00
newtype_index.rs Use `#[expect(lint)]` over `#[allow(lint)]` where possible (#17822) 2025-05-03 21:20:31 +02:00
rule_code_prefix.rs Upgrade to Rust 1.82 (#13816) 2024-10-19 16:05:50 +02:00
rule_namespace.rs Unify `OldDiagnostic` and `Message` (#18391) 2025-06-19 09:37:58 -04:00
rust_doc.rs [ty] Allow overriding rules for specific files (#18648) 2025-06-15 14:27:39 +01:00
violation_metadata.rs Add a `ViolationMetadata::rule` method (#18234) 2025-05-28 09:27:09 -04:00