diff --git a/crates/ruff/src/checkers/ast/analyze/statement.rs b/crates/ruff/src/checkers/ast/analyze/statement.rs index 0f169d6969a011..817c9705df41cf 100644 --- a/crates/ruff/src/checkers/ast/analyze/statement.rs +++ b/crates/ruff/src/checkers/ast/analyze/statement.rs @@ -1151,6 +1151,9 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) { if checker.enabled(Rule::ManualListCopy) { perflint::rules::manual_list_copy(checker, target, body); } + if checker.enabled(Rule::ManualDictComprehension) { + perflint::rules::manual_dict_comprehension(checker, target, body); + } if checker.enabled(Rule::UnnecessaryListCast) { perflint::rules::unnecessary_list_cast(checker, iter); } diff --git a/crates/ruff/src/rules/perflint/rules/manual_dict_comprehension.rs b/crates/ruff/src/rules/perflint/rules/manual_dict_comprehension.rs index 7fef039c6fe409..a71c872dc59dcb 100644 --- a/crates/ruff/src/rules/perflint/rules/manual_dict_comprehension.rs +++ b/crates/ruff/src/rules/perflint/rules/manual_dict_comprehension.rs @@ -1,4 +1,4 @@ -use rustpython_parser::ast::{self, Expr, Stmt}; +use ruff_python_ast::{self as ast, Expr, Stmt}; use ruff_diagnostics::{Diagnostic, Violation}; use ruff_macros::{derive_message_formats, violation}; @@ -43,7 +43,7 @@ impl Violation for ManualDictComprehension { } } -/// PERF404 +/// PERF403 pub(crate) fn manual_dict_comprehension(checker: &mut Checker, target: &Expr, body: &[Stmt]) { let [stmt] = body else { return; diff --git a/crates/ruff_python_formatter/README.md b/crates/ruff_python_formatter/README.md index af3562987a1835..99b8eab0828ff3 100644 --- a/crates/ruff_python_formatter/README.md +++ b/crates/ruff_python_formatter/README.md @@ -312,7 +312,7 @@ a different strategy until all strategies are exhausted. ## The orphan rules and trait structure For the formatter, we would like to implement `Format` from the rust_formatter crate for all AST -nodes, defined in the rustpython_parser crate. This violates Rust's orphan rules. We therefore +nodes, defined in the ruff_python_parser crate. This violates Rust's orphan rules. We therefore generate in `generate.py` a newtype for each AST node with implementations of `FormatNodeRule`, `FormatRule`, `AsFormat` and `IntoFormat` on it.