Skip to content

Commit 30c8320

Browse files
ntBreMichaReiser
authored andcommitted
[ruff] Stabilize unnecessary-cast-to-int (RUF046) (#16649)
Summary -- Stabilizes RUF046 and moves its test to the right place. The docs look good. Test Plan -- 2 closed newline/whitespace issues from early January and 1 closed issue about really being multiple rules, but otherwise no recent issues or PRs.
1 parent 7e2810b commit 30c8320

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

crates/ruff_linter/src/codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
10011001
(Ruff, "041") => (RuleGroup::Preview, rules::ruff::rules::UnnecessaryNestedLiteral),
10021002
(Ruff, "043") => (RuleGroup::Preview, rules::ruff::rules::PytestRaisesAmbiguousPattern),
10031003
(Ruff, "045") => (RuleGroup::Preview, rules::ruff::rules::ImplicitClassVarInDataclass),
1004-
(Ruff, "046") => (RuleGroup::Preview, rules::ruff::rules::UnnecessaryCastToInt),
1004+
(Ruff, "046") => (RuleGroup::Stable, rules::ruff::rules::UnnecessaryCastToInt),
10051005
(Ruff, "047") => (RuleGroup::Preview, rules::ruff::rules::NeedlessElse),
10061006
(Ruff, "048") => (RuleGroup::Preview, rules::ruff::rules::MapIntVersionParsing),
10071007
(Ruff, "049") => (RuleGroup::Preview, rules::ruff::rules::DataclassEnum),

crates/ruff_linter/src/rules/ruff/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ mod tests {
8383
#[test_case(Rule::InvalidAssertMessageLiteralArgument, Path::new("RUF040.py"))]
8484
#[test_case(Rule::UnnecessaryNestedLiteral, Path::new("RUF041.py"))]
8585
#[test_case(Rule::UnnecessaryNestedLiteral, Path::new("RUF041.pyi"))]
86+
#[test_case(Rule::UnnecessaryCastToInt, Path::new("RUF046.py"))]
8687
#[test_case(Rule::NeedlessElse, Path::new("RUF047_if.py"))]
8788
#[test_case(Rule::NeedlessElse, Path::new("RUF047_for.py"))]
8889
#[test_case(Rule::NeedlessElse, Path::new("RUF047_while.py"))]
@@ -426,7 +427,6 @@ mod tests {
426427
#[test_case(Rule::UnnecessaryRegularExpression, Path::new("RUF055_0.py"))]
427428
#[test_case(Rule::UnnecessaryRegularExpression, Path::new("RUF055_1.py"))]
428429
#[test_case(Rule::UnnecessaryRegularExpression, Path::new("RUF055_2.py"))]
429-
#[test_case(Rule::UnnecessaryCastToInt, Path::new("RUF046.py"))]
430430
#[test_case(Rule::PytestRaisesAmbiguousPattern, Path::new("RUF043.py"))]
431431
#[test_case(Rule::UnnecessaryRound, Path::new("RUF057.py"))]
432432
#[test_case(Rule::DataclassEnum, Path::new("RUF049.py"))]

crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF046_RUF046.py.snap renamed to crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF046_RUF046.py.snap

File renamed without changes.

0 commit comments

Comments
 (0)