From 8c9215489e754c70128f331330b0cefe416d41ba Mon Sep 17 00:00:00 2001 From: Sladyn Date: Wed, 24 May 2023 09:16:33 -0700 Subject: [PATCH] Migrate flake8_bugbear rules to `unspecified` to `suggested` (#4616) --- .../src/rules/flake8_bugbear/rules/getattr_with_constant.rs | 4 +--- .../src/rules/flake8_bugbear/rules/setattr_with_constant.rs | 4 +--- .../flake8_bugbear/rules/unused_loop_control_variable.rs | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/crates/ruff/src/rules/flake8_bugbear/rules/getattr_with_constant.rs b/crates/ruff/src/rules/flake8_bugbear/rules/getattr_with_constant.rs index 2cfd46603bbb7..ff57ce600fa3c 100644 --- a/crates/ruff/src/rules/flake8_bugbear/rules/getattr_with_constant.rs +++ b/crates/ruff/src/rules/flake8_bugbear/rules/getattr_with_constant.rs @@ -64,10 +64,8 @@ pub(crate) fn getattr_with_constant( } let mut diagnostic = Diagnostic::new(GetAttrWithConstant, expr.range()); - if checker.patch(diagnostic.kind.rule()) { - #[allow(deprecated)] - diagnostic.set_fix(Fix::unspecified(Edit::range_replacement( + diagnostic.set_fix(Fix::suggested(Edit::range_replacement( checker.generator().expr(&attribute(obj, value)), expr.range(), ))); diff --git a/crates/ruff/src/rules/flake8_bugbear/rules/setattr_with_constant.rs b/crates/ruff/src/rules/flake8_bugbear/rules/setattr_with_constant.rs index d51201a94db85..9229339bf3de0 100644 --- a/crates/ruff/src/rules/flake8_bugbear/rules/setattr_with_constant.rs +++ b/crates/ruff/src/rules/flake8_bugbear/rules/setattr_with_constant.rs @@ -79,10 +79,8 @@ pub(crate) fn setattr_with_constant( { if expr == child.as_ref() { let mut diagnostic = Diagnostic::new(SetAttrWithConstant, expr.range()); - if checker.patch(diagnostic.kind.rule()) { - #[allow(deprecated)] - diagnostic.set_fix(Fix::unspecified(Edit::range_replacement( + diagnostic.set_fix(Fix::suggested(Edit::range_replacement( assignment(obj, name, value, checker.generator()), expr.range(), ))); diff --git a/crates/ruff/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs b/crates/ruff/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs index b353a6337e622..ad64d880b6925 100644 --- a/crates/ruff/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs +++ b/crates/ruff/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs @@ -160,8 +160,7 @@ pub(crate) fn unused_loop_control_variable(checker: &mut Checker, target: &Expr, .map(|binding_id| &checker.semantic_model().bindings[binding_id]) .all(|binding| !binding.is_used()) { - #[allow(deprecated)] - diagnostic.set_fix(Fix::unspecified(Edit::range_replacement( + diagnostic.set_fix(Fix::suggested(Edit::range_replacement( rename, expr.range(), )));