We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d04d40d commit bba7f6dCopy full SHA for bba7f6d
crates/ruff_linter/src/message/mod.rs
@@ -284,11 +284,8 @@ impl OldDiagnostic {
284
285
/// Returns the [`Rule`] corresponding to the diagnostic message.
286
pub fn to_rule(&self) -> Option<Rule> {
287
- if self.is_syntax_error() {
288
- None
289
- } else {
290
- Some(self.name().parse().expect("Expected a valid rule name"))
291
- }
+ self.noqa_code
+ .map(|code| Rule::from_code(&code.to_string()).expect("Expected a valid noqa code"))
292
}
293
294
/// Returns the [`NoqaCode`] corresponding to the diagnostic message.
0 commit comments