diff --git a/crates/ruff_linter/resources/test/fixtures/refurb/FURB110.py b/crates/ruff_linter/resources/test/fixtures/refurb/FURB110.py index 44960b6b74..706d78a4f0 100644 --- a/crates/ruff_linter/resources/test/fixtures/refurb/FURB110.py +++ b/crates/ruff_linter/resources/test/fixtures/refurb/FURB110.py @@ -28,3 +28,13 @@ z = ( y ) ) + +# FURB110 +z = ( + x if + # If true, use x. + x + # Otherwise, use y. + else + y +) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap index c49c21b90f..69ae14f940 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap @@ -148,3 +148,32 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator 27 27 | # Test for y. 28 28 | y 29 29 | ) + +FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator + | +32 | # FURB110 +33 | z = ( +34 | x if + | _____^ +35 | | # If true, use x. +36 | | x +37 | | # Otherwise, use y. +38 | | else +39 | | y + | |_____^ FURB110 +40 | ) + | + = help: Replace with `or` operator + +ℹ Safe fix +31 31 | +32 32 | # FURB110 +33 33 | z = ( +34 |- x if +35 |- # If true, use x. +36 |- x +37 |- # Otherwise, use y. +38 |- else +39 |- y + 34 |+ x or y +40 35 | )