Skip to content

Commit

Permalink
Migrate some rules from Fix::unspecified (#4587)
Browse files Browse the repository at this point in the history
  • Loading branch information
sladyn98 authored May 24, 2023
1 parent a256fdb commit 4e84e8a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/ruff/src/rules/flake8_bugbear/rules/assert_false.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub(crate) fn assert_false(checker: &mut Checker, stmt: &Stmt, test: &Expr, msg:
let mut diagnostic = Diagnostic::new(AssertFalse, test.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().stmt(&assertion_error(msg)),
stmt.range(),
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn duplicate_handler_exceptions<'a>(
);
if checker.patch(diagnostic.kind.rule()) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::suggested(Edit::range_replacement(
if unique_elts.len() == 1 {
checker.generator().expr(unique_elts[0])
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub(crate) fn redundant_tuple_in_exception_handler(
);
if checker.patch(diagnostic.kind.rule()) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
checker.generator().expr(elt),
type_.range(),
)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
assertion_line: 57
---
B013.py:3:8: B013 [*] A length-one tuple literal is redundant. Write `except ValueError` instead of `except (ValueError,)`.
|
Expand All @@ -12,7 +13,7 @@ B013.py:3:8: B013 [*] A length-one tuple literal is redundant. Write `except Val
|
= help: Replace with `except ValueError`

Suggested fix
Fix
1 1 | try:
2 2 | pass
3 |-except (ValueError,):
Expand Down

0 comments on commit 4e84e8a

Please sign in to comment.