---
source: crates/ruff_linter/src/rules/refurb/mod.rs
---
FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)`
  |
2 | y = 2
3 | 
4 | x if x > y else y  # FURB136
  | ^^^^^^^^^^^^^^^^^ FURB136
5 | 
6 | x if x >= y else y  # FURB136
  |
  = help: Replace with `max(y, x)`

ℹ Safe fix
1 1 | x = 1
2 2 | y = 2
3 3 | 
4   |-x if x > y else y  # FURB136
  4 |+max(y, x)  # FURB136
5 5 | 
6 6 | x if x >= y else y  # FURB136
7 7 | 

FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)`
  |
4 | x if x > y else y  # FURB136
5 | 
6 | x if x >= y else y  # FURB136
  | ^^^^^^^^^^^^^^^^^^ FURB136
7 | 
8 | x if x < y else y  # FURB136
  |
  = help: Replace with `max(x, y)`

ℹ Safe fix
3 3 | 
4 4 | x if x > y else y  # FURB136
5 5 | 
6   |-x if x >= y else y  # FURB136
  6 |+max(x, y)  # FURB136
7 7 | 
8 8 | x if x < y else y  # FURB136
9 9 | 

FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)`
   |
 6 | x if x >= y else y  # FURB136
 7 | 
 8 | x if x < y else y  # FURB136
   | ^^^^^^^^^^^^^^^^^ FURB136
 9 | 
10 | x if x <= y else y  # FURB136
   |
   = help: Replace with `min(y, x)`

ℹ Safe fix
5 5 | 
6 6 | x if x >= y else y  # FURB136
7 7 | 
8   |-x if x < y else y  # FURB136
  8 |+min(y, x)  # FURB136
9 9 | 
10 10 | x if x <= y else y  # FURB136
11 11 | 

FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)`
   |
 8 | x if x < y else y  # FURB136
 9 | 
10 | x if x <= y else y  # FURB136
   | ^^^^^^^^^^^^^^^^^^ FURB136
11 | 
12 | y if x > y else x  # FURB136
   |
   = help: Replace with `min(x, y)`

ℹ Safe fix
7  7  | 
8  8  | x if x < y else y  # FURB136
9  9  | 
10    |-x if x <= y else y  # FURB136
   10 |+min(x, y)  # FURB136
11 11 | 
12 12 | y if x > y else x  # FURB136
13 13 | 

FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)`
   |
10 | x if x <= y else y  # FURB136
11 | 
12 | y if x > y else x  # FURB136
   | ^^^^^^^^^^^^^^^^^ FURB136
13 | 
14 | y if x >= y else x  # FURB136
   |
   = help: Replace with `min(x, y)`

ℹ Safe fix
9  9  | 
10 10 | x if x <= y else y  # FURB136
11 11 | 
12    |-y if x > y else x  # FURB136
   12 |+min(x, y)  # FURB136
13 13 | 
14 14 | y if x >= y else x  # FURB136
15 15 | 

FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)`
   |
12 | y if x > y else x  # FURB136
13 | 
14 | y if x >= y else x  # FURB136
   | ^^^^^^^^^^^^^^^^^^ FURB136
15 | 
16 | y if x < y else x  # FURB136
   |
   = help: Replace with `min(y, x)`

ℹ Safe fix
11 11 | 
12 12 | y if x > y else x  # FURB136
13 13 | 
14    |-y if x >= y else x  # FURB136
   14 |+min(y, x)  # FURB136
15 15 | 
16 16 | y if x < y else x  # FURB136
17 17 | 

FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)`
   |
14 | y if x >= y else x  # FURB136
15 | 
16 | y if x < y else x  # FURB136
   | ^^^^^^^^^^^^^^^^^ FURB136
17 | 
18 | y if x <= y else x  # FURB136
   |
   = help: Replace with `max(x, y)`

ℹ Safe fix
13 13 | 
14 14 | y if x >= y else x  # FURB136
15 15 | 
16    |-y if x < y else x  # FURB136
   16 |+max(x, y)  # FURB136
17 17 | 
18 18 | y if x <= y else x  # FURB136
19 19 | 

FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)`
   |
16 | y if x < y else x  # FURB136
17 | 
18 | y if x <= y else x  # FURB136
   | ^^^^^^^^^^^^^^^^^^ FURB136
19 | 
20 | x + y if x > y else y  # OK
   |
   = help: Replace with `max(y, x)`

ℹ Safe fix
15 15 | 
16 16 | y if x < y else x  # FURB136
17 17 | 
18    |-y if x <= y else x  # FURB136
   18 |+max(y, x)  # FURB136
19 19 | 
20 20 | x + y if x > y else y  # OK
21 21 | 

FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)`
   |
20 |   x + y if x > y else y  # OK
21 |   
22 | / x if (
23 | |     x
24 | |     > y
25 | | ) else y  # FURB136
   | |________^ FURB136
   |
   = help: Replace with `max(y, x)`

ℹ Safe fix
19 19 | 
20 20 | x + y if x > y else y  # OK
21 21 | 
22    |-x if (
23    |-    x
24    |-    > y
25    |-) else y  # FURB136
   22 |+max(y, x)  # FURB136


