Skip to content

Commit

Permalink
buf-fix: flake8_simplify SIM212 (#1732)
Browse files Browse the repository at this point in the history
bug-fix in #1717

Use the correct `IfExprWithTwistedArms` struct.
  • Loading branch information
chammika-become authored Jan 8, 2023
1 parent 491b1e4 commit 212ce4d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/flake8_simplify/plugins/ast_ifexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn twisted_arms_in_ifexpr(
}

let mut check = Check::new(
violations::NegateEqualOp(
violations::IfExprWithTwistedArms(
unparse_expr(body, checker.style),
unparse_expr(orelse, checker.style),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/flake8_simplify/mod.rs
expression: checks
---
- kind:
NegateEqualOp:
IfExprWithTwistedArms:
- b
- a
location:
Expand All @@ -12,10 +12,17 @@ expression: checks
end_location:
row: 1
column: 21
fix: ~
fix:
content: a if a else b
location:
row: 1
column: 4
end_location:
row: 1
column: 21
parent: ~
- kind:
NegateEqualOp:
IfExprWithTwistedArms:
- b + c
- a
location:
Expand All @@ -24,6 +31,13 @@ expression: checks
end_location:
row: 3
column: 25
fix: ~
fix:
content: a if a else b + c
location:
row: 3
column: 4
end_location:
row: 3
column: 25
parent: ~

0 comments on commit 212ce4d

Please sign in to comment.