rule 4/8: Remove Display impl for Rule

This commit is contained in:
Martin Fischer 2023-01-18 00:59:58 +01:00 committed by Charlie Marsh
parent dbcab5128c
commit 3534e370e1
3 changed files with 7 additions and 6 deletions

View File

@ -177,8 +177,10 @@ impl<'a> Printer<'a> {
message.location.column(), message.location.column(),
message.kind.body() message.kind.body()
)); ));
let mut case = let mut case = TestCase::new(
TestCase::new(format!("org.ruff.{}", message.kind.rule()), status); format!("org.ruff.{}", message.kind.rule().code()),
status,
);
let file_path = Path::new(filename); let file_path = Path::new(filename);
let file_stem = file_path.file_stem().unwrap().to_str().unwrap(); let file_stem = file_path.file_stem().unwrap().to_str().unwrap();
let classname = file_path.parent().unwrap().join(file_stem); let classname = file_path.parent().unwrap().join(file_stem);
@ -255,7 +257,7 @@ impl<'a> Printer<'a> {
stdout, stdout,
"::error title=Ruff \ "::error title=Ruff \
({}),file={},line={},col={},endLine={},endColumn={}::{}", ({}),file={},line={},col={},endLine={},endColumn={}::{}",
message.kind.rule(), message.kind.rule().code(),
message.filename, message.filename,
message.location.row(), message.location.row(),
message.location.column(), message.location.column(),
@ -276,7 +278,7 @@ impl<'a> Printer<'a> {
.iter() .iter()
.map(|message| { .map(|message| {
json!({ json!({
"description": format!("({}) {}", message.kind.rule(), message.kind.body()), "description": format!("({}) {}", message.kind.rule().code(), message.kind.body()),
"severity": "major", "severity": "major",
"fingerprint": message.kind.rule(), "fingerprint": message.kind.rule(),
"location": { "location": {

View File

@ -51,7 +51,6 @@ pub fn define_rule_mapping(mapping: &Mapping) -> proc_macro2::TokenStream {
EnumIter, EnumIter,
EnumString, // TODO(martin): Remove EnumString, // TODO(martin): Remove
Debug, Debug,
Display, // TODO(martin): Remove
PartialEq, PartialEq,
Eq, Eq,
Clone, Clone,

View File

@ -5,7 +5,7 @@ use once_cell::sync::Lazy;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use rustpython_parser::ast::Location; use rustpython_parser::ast::Location;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strum_macros::{AsRefStr, Display, EnumIter, EnumString}; use strum_macros::{AsRefStr, EnumIter, EnumString};
use crate::ast::types::Range; use crate::ast::types::Range;
use crate::fix::Fix; use crate::fix::Fix;