Skip to content

Commit

Permalink
Add Applicability to flake8_comma fixes (#5127)
Browse files Browse the repository at this point in the history
## Summary

Fixes some of #4184
  • Loading branch information
evanrittenhouse authored Jun 15, 2023
1 parent 107a295 commit 6143065
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 47 deletions.
6 changes: 2 additions & 4 deletions crates/ruff/src/rules/flake8_commas/rules/trailing_commas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ pub(crate) fn trailing_commas(
let comma = prev.spanned.unwrap();
let mut diagnostic = Diagnostic::new(ProhibitedTrailingComma, comma.1);
if settings.rules.should_fix(Rule::ProhibitedTrailingComma) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_deletion(diagnostic.range())));
diagnostic.set_fix(Fix::automatic(Edit::range_deletion(diagnostic.range())));
}
diagnostics.push(diagnostic);
}
Expand Down Expand Up @@ -367,8 +366,7 @@ pub(crate) fn trailing_commas(
// removing any brackets in the same linter pass - doing both at the same time could
// lead to a syntax error.
let contents = locator.slice(missing_comma.1);
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
format!("{contents},"),
missing_comma.1,
)));
Expand Down
Loading

0 comments on commit 6143065

Please sign in to comment.