---
source: crates/ruff_linter/src/rules/refurb/mod.rs
---
FURB118 [*] Use `operator.invert` instead of defining a lambda
 --> FURB118.py:2:13
  |
1 | # Errors.
2 | op_bitnot = lambda x: ~x
  |             ^^^^^^^^^^^^
3 | op_not = lambda x: not x
4 | op_pos = lambda x: +x
  |
help: Replace with `operator.invert`
  |
1 | # Errors.
  - op_bitnot = lambda x: ~x
2 + import operator
3 + op_bitnot = operator.invert
4 | op_not = lambda x: not x
  |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.not_` instead of defining a lambda
 --> FURB118.py:3:10
  |
1 | # Errors.
2 | op_bitnot = lambda x: ~x
3 | op_not = lambda x: not x
  |          ^^^^^^^^^^^^^^^
4 | op_pos = lambda x: +x
5 | op_neg = lambda x: -x
  |
help: Replace with `operator.not_`
  |
1 | # Errors.
2 + import operator
3 | op_bitnot = lambda x: ~x
  - op_not = lambda x: not x
4 + op_not = operator.not_
5 | op_pos = lambda x: +x
  |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.pos` instead of defining a lambda
 --> FURB118.py:4:10
  |
2 | op_bitnot = lambda x: ~x
3 | op_not = lambda x: not x
4 | op_pos = lambda x: +x
  |          ^^^^^^^^^^^^
5 | op_neg = lambda x: -x
  |
help: Replace with `operator.pos`
  |
1 | # Errors.
2 + import operator
3 | op_bitnot = lambda x: ~x
4 | op_not = lambda x: not x
  - op_pos = lambda x: +x
5 + op_pos = operator.pos
6 | op_neg = lambda x: -x
  |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.neg` instead of defining a lambda
 --> FURB118.py:5:10
  |
3 | op_not = lambda x: not x
4 | op_pos = lambda x: +x
5 | op_neg = lambda x: -x
  |          ^^^^^^^^^^^^
6 |
7 | op_add = lambda x, y: x + y
  |
help: Replace with `operator.neg`
  |
1 | # Errors.
2 + import operator
3 | op_bitnot = lambda x: ~x
4 | op_not = lambda x: not x
5 | op_pos = lambda x: +x
  - op_neg = lambda x: -x
6 + op_neg = operator.neg
7 |
  |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.add` instead of defining a lambda
 --> FURB118.py:7:10
  |
5 | op_neg = lambda x: -x
6 |
7 | op_add = lambda x, y: x + y
  |          ^^^^^^^^^^^^^^^^^^
8 | op_sub = lambda x, y: x - y
9 | op_mult = lambda x, y: x * y
  |
help: Replace with `operator.add`
  |
1 | # Errors.
2 + import operator
3 | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
7 |
  - op_add = lambda x, y: x + y
8 + op_add = operator.add
9 | op_sub = lambda x, y: x - y
  |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.sub` instead of defining a lambda
  --> FURB118.py:8:10
   |
 7 | op_add = lambda x, y: x + y
 8 | op_sub = lambda x, y: x - y
   |          ^^^^^^^^^^^^^^^^^^
 9 | op_mult = lambda x, y: x * y
10 | op_matmutl = lambda x, y: x @ y
   |
help: Replace with `operator.sub`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
8  | op_add = lambda x, y: x + y
   - op_sub = lambda x, y: x - y
9  + op_sub = operator.sub
10 | op_mult = lambda x, y: x * y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.mul` instead of defining a lambda
  --> FURB118.py:9:11
   |
 7 | op_add = lambda x, y: x + y
 8 | op_sub = lambda x, y: x - y
 9 | op_mult = lambda x, y: x * y
   |           ^^^^^^^^^^^^^^^^^^
10 | op_matmutl = lambda x, y: x @ y
11 | op_truediv = lambda x, y: x / y
   |
help: Replace with `operator.mul`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
9  | op_sub = lambda x, y: x - y
   - op_mult = lambda x, y: x * y
10 + op_mult = operator.mul
11 | op_matmutl = lambda x, y: x @ y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.matmul` instead of defining a lambda
  --> FURB118.py:10:14
   |
 8 | op_sub = lambda x, y: x - y
 9 | op_mult = lambda x, y: x * y
10 | op_matmutl = lambda x, y: x @ y
   |              ^^^^^^^^^^^^^^^^^^
11 | op_truediv = lambda x, y: x / y
12 | op_mod = lambda x, y: x % y
   |
help: Replace with `operator.matmul`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
10 | op_mult = lambda x, y: x * y
   - op_matmutl = lambda x, y: x @ y
11 + op_matmutl = operator.matmul
12 | op_truediv = lambda x, y: x / y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.truediv` instead of defining a lambda
  --> FURB118.py:11:14
   |
 9 | op_mult = lambda x, y: x * y
10 | op_matmutl = lambda x, y: x @ y
11 | op_truediv = lambda x, y: x / y
   |              ^^^^^^^^^^^^^^^^^^
12 | op_mod = lambda x, y: x % y
13 | op_pow = lambda x, y: x ** y
   |
help: Replace with `operator.truediv`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
11 | op_matmutl = lambda x, y: x @ y
   - op_truediv = lambda x, y: x / y
12 + op_truediv = operator.truediv
13 | op_mod = lambda x, y: x % y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.mod` instead of defining a lambda
  --> FURB118.py:12:10
   |
10 | op_matmutl = lambda x, y: x @ y
11 | op_truediv = lambda x, y: x / y
12 | op_mod = lambda x, y: x % y
   |          ^^^^^^^^^^^^^^^^^^
13 | op_pow = lambda x, y: x ** y
14 | op_lshift = lambda x, y: x << y
   |
help: Replace with `operator.mod`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
12 | op_truediv = lambda x, y: x / y
   - op_mod = lambda x, y: x % y
13 + op_mod = operator.mod
14 | op_pow = lambda x, y: x ** y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.pow` instead of defining a lambda
  --> FURB118.py:13:10
   |
11 | op_truediv = lambda x, y: x / y
12 | op_mod = lambda x, y: x % y
13 | op_pow = lambda x, y: x ** y
   |          ^^^^^^^^^^^^^^^^^^^
14 | op_lshift = lambda x, y: x << y
15 | op_rshift = lambda x, y: x >> y
   |
help: Replace with `operator.pow`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
13 | op_mod = lambda x, y: x % y
   - op_pow = lambda x, y: x ** y
14 + op_pow = operator.pow
15 | op_lshift = lambda x, y: x << y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.lshift` instead of defining a lambda
  --> FURB118.py:14:13
   |
12 | op_mod = lambda x, y: x % y
13 | op_pow = lambda x, y: x ** y
14 | op_lshift = lambda x, y: x << y
   |             ^^^^^^^^^^^^^^^^^^^
15 | op_rshift = lambda x, y: x >> y
16 | op_bitor = lambda x, y: x | y
   |
help: Replace with `operator.lshift`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
14 | op_pow = lambda x, y: x ** y
   - op_lshift = lambda x, y: x << y
15 + op_lshift = operator.lshift
16 | op_rshift = lambda x, y: x >> y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.rshift` instead of defining a lambda
  --> FURB118.py:15:13
   |
13 | op_pow = lambda x, y: x ** y
14 | op_lshift = lambda x, y: x << y
15 | op_rshift = lambda x, y: x >> y
   |             ^^^^^^^^^^^^^^^^^^^
16 | op_bitor = lambda x, y: x | y
17 | op_xor = lambda x, y: x ^ y
   |
help: Replace with `operator.rshift`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
15 | op_lshift = lambda x, y: x << y
   - op_rshift = lambda x, y: x >> y
16 + op_rshift = operator.rshift
17 | op_bitor = lambda x, y: x | y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.or_` instead of defining a lambda
  --> FURB118.py:16:12
   |
14 | op_lshift = lambda x, y: x << y
15 | op_rshift = lambda x, y: x >> y
16 | op_bitor = lambda x, y: x | y
   |            ^^^^^^^^^^^^^^^^^^
17 | op_xor = lambda x, y: x ^ y
18 | op_bitand = lambda x, y: x & y
   |
help: Replace with `operator.or_`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
16 | op_rshift = lambda x, y: x >> y
   - op_bitor = lambda x, y: x | y
17 + op_bitor = operator.or_
18 | op_xor = lambda x, y: x ^ y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.xor` instead of defining a lambda
  --> FURB118.py:17:10
   |
15 | op_rshift = lambda x, y: x >> y
16 | op_bitor = lambda x, y: x | y
17 | op_xor = lambda x, y: x ^ y
   |          ^^^^^^^^^^^^^^^^^^
18 | op_bitand = lambda x, y: x & y
19 | op_floordiv = lambda x, y: x // y
   |
help: Replace with `operator.xor`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
17 | op_bitor = lambda x, y: x | y
   - op_xor = lambda x, y: x ^ y
18 + op_xor = operator.xor
19 | op_bitand = lambda x, y: x & y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.and_` instead of defining a lambda
  --> FURB118.py:18:13
   |
16 | op_bitor = lambda x, y: x | y
17 | op_xor = lambda x, y: x ^ y
18 | op_bitand = lambda x, y: x & y
   |             ^^^^^^^^^^^^^^^^^^
19 | op_floordiv = lambda x, y: x // y
   |
help: Replace with `operator.and_`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
18 | op_xor = lambda x, y: x ^ y
   - op_bitand = lambda x, y: x & y
19 + op_bitand = operator.and_
20 | op_floordiv = lambda x, y: x // y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.floordiv` instead of defining a lambda
  --> FURB118.py:19:15
   |
17 | op_xor = lambda x, y: x ^ y
18 | op_bitand = lambda x, y: x & y
19 | op_floordiv = lambda x, y: x // y
   |               ^^^^^^^^^^^^^^^^^^^
20 |
21 | op_eq = lambda x, y: x == y
   |
help: Replace with `operator.floordiv`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
19 | op_bitand = lambda x, y: x & y
   - op_floordiv = lambda x, y: x // y
20 + op_floordiv = operator.floordiv
21 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.eq` instead of defining a lambda
  --> FURB118.py:21:9
   |
19 | op_floordiv = lambda x, y: x // y
20 |
21 | op_eq = lambda x, y: x == y
   |         ^^^^^^^^^^^^^^^^^^^
22 | op_ne = lambda x, y: x != y
23 | op_lt = lambda x, y: x < y
   |
help: Replace with `operator.eq`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
21 |
   - op_eq = lambda x, y: x == y
22 + op_eq = operator.eq
23 | op_ne = lambda x, y: x != y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.ne` instead of defining a lambda
  --> FURB118.py:22:9
   |
21 | op_eq = lambda x, y: x == y
22 | op_ne = lambda x, y: x != y
   |         ^^^^^^^^^^^^^^^^^^^
23 | op_lt = lambda x, y: x < y
24 | op_lte = lambda x, y: x <= y
   |
help: Replace with `operator.ne`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
22 | op_eq = lambda x, y: x == y
   - op_ne = lambda x, y: x != y
23 + op_ne = operator.ne
24 | op_lt = lambda x, y: x < y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.lt` instead of defining a lambda
  --> FURB118.py:23:9
   |
21 | op_eq = lambda x, y: x == y
22 | op_ne = lambda x, y: x != y
23 | op_lt = lambda x, y: x < y
   |         ^^^^^^^^^^^^^^^^^^
24 | op_lte = lambda x, y: x <= y
25 | op_gt = lambda x, y: x > y
   |
help: Replace with `operator.lt`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
23 | op_ne = lambda x, y: x != y
   - op_lt = lambda x, y: x < y
24 + op_lt = operator.lt
25 | op_lte = lambda x, y: x <= y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.le` instead of defining a lambda
  --> FURB118.py:24:10
   |
22 | op_ne = lambda x, y: x != y
23 | op_lt = lambda x, y: x < y
24 | op_lte = lambda x, y: x <= y
   |          ^^^^^^^^^^^^^^^^^^^
25 | op_gt = lambda x, y: x > y
26 | op_gte = lambda x, y: x >= y
   |
help: Replace with `operator.le`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
24 | op_lt = lambda x, y: x < y
   - op_lte = lambda x, y: x <= y
25 + op_lte = operator.le
26 | op_gt = lambda x, y: x > y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.gt` instead of defining a lambda
  --> FURB118.py:25:9
   |
23 | op_lt = lambda x, y: x < y
24 | op_lte = lambda x, y: x <= y
25 | op_gt = lambda x, y: x > y
   |         ^^^^^^^^^^^^^^^^^^
26 | op_gte = lambda x, y: x >= y
27 | op_is = lambda x, y: x is y
   |
help: Replace with `operator.gt`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
25 | op_lte = lambda x, y: x <= y
   - op_gt = lambda x, y: x > y
26 + op_gt = operator.gt
27 | op_gte = lambda x, y: x >= y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.ge` instead of defining a lambda
  --> FURB118.py:26:10
   |
24 | op_lte = lambda x, y: x <= y
25 | op_gt = lambda x, y: x > y
26 | op_gte = lambda x, y: x >= y
   |          ^^^^^^^^^^^^^^^^^^^
27 | op_is = lambda x, y: x is y
28 | op_isnot = lambda x, y: x is not y
   |
help: Replace with `operator.ge`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
26 | op_gt = lambda x, y: x > y
   - op_gte = lambda x, y: x >= y
27 + op_gte = operator.ge
28 | op_is = lambda x, y: x is y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.is_` instead of defining a lambda
  --> FURB118.py:27:9
   |
25 | op_gt = lambda x, y: x > y
26 | op_gte = lambda x, y: x >= y
27 | op_is = lambda x, y: x is y
   |         ^^^^^^^^^^^^^^^^^^^
28 | op_isnot = lambda x, y: x is not y
29 | op_in = lambda x, y: y in x
   |
help: Replace with `operator.is_`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
27 | op_gte = lambda x, y: x >= y
   - op_is = lambda x, y: x is y
28 + op_is = operator.is_
29 | op_isnot = lambda x, y: x is not y
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.is_not` instead of defining a lambda
  --> FURB118.py:28:12
   |
26 | op_gte = lambda x, y: x >= y
27 | op_is = lambda x, y: x is y
28 | op_isnot = lambda x, y: x is not y
   |            ^^^^^^^^^^^^^^^^^^^^^^^
29 | op_in = lambda x, y: y in x
30 | op_itemgetter = lambda x: x[0]
   |
help: Replace with `operator.is_not`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
28 | op_is = lambda x, y: x is y
   - op_isnot = lambda x, y: x is not y
29 + op_isnot = operator.is_not
30 | op_in = lambda x, y: y in x
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.contains` instead of defining a lambda
  --> FURB118.py:29:9
   |
27 | op_is = lambda x, y: x is y
28 | op_isnot = lambda x, y: x is not y
29 | op_in = lambda x, y: y in x
   |         ^^^^^^^^^^^^^^^^^^^
30 | op_itemgetter = lambda x: x[0]
31 | op_itemgetter = lambda x: (x[0], x[1], x[2])
   |
help: Replace with `operator.contains`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
29 | op_isnot = lambda x, y: x is not y
   - op_in = lambda x, y: y in x
30 + op_in = operator.contains
31 | op_itemgetter = lambda x: x[0]
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter(0)` instead of defining a lambda
  --> FURB118.py:30:17
   |
28 | op_isnot = lambda x, y: x is not y
29 | op_in = lambda x, y: y in x
30 | op_itemgetter = lambda x: x[0]
   |                 ^^^^^^^^^^^^^^
31 | op_itemgetter = lambda x: (x[0], x[1], x[2])
32 | op_itemgetter = lambda x: (x[1:], x[2])
   |
help: Replace with `operator.itemgetter(0)`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
30 | op_in = lambda x, y: y in x
   - op_itemgetter = lambda x: x[0]
31 + op_itemgetter = operator.itemgetter(0)
32 | op_itemgetter = lambda x: (x[0], x[1], x[2])
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defining a lambda
  --> FURB118.py:31:17
   |
29 | op_in = lambda x, y: y in x
30 | op_itemgetter = lambda x: x[0]
31 | op_itemgetter = lambda x: (x[0], x[1], x[2])
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32 | op_itemgetter = lambda x: (x[1:], x[2])
33 | op_itemgetter = lambda x: x[:]
   |
help: Replace with `operator.itemgetter(0, 1, 2)`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
31 | op_itemgetter = lambda x: x[0]
   - op_itemgetter = lambda x: (x[0], x[1], x[2])
32 + op_itemgetter = operator.itemgetter(0, 1, 2)
33 | op_itemgetter = lambda x: (x[1:], x[2])
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` instead of defining a lambda
  --> FURB118.py:32:17
   |
30 | op_itemgetter = lambda x: x[0]
31 | op_itemgetter = lambda x: (x[0], x[1], x[2])
32 | op_itemgetter = lambda x: (x[1:], x[2])
   |                 ^^^^^^^^^^^^^^^^^^^^^^^
33 | op_itemgetter = lambda x: x[:]
34 | op_itemgetter = lambda x: x[0, 1]
   |
help: Replace with `operator.itemgetter(slice(1, None), 2)`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
32 | op_itemgetter = lambda x: (x[0], x[1], x[2])
   - op_itemgetter = lambda x: (x[1:], x[2])
33 + op_itemgetter = operator.itemgetter(slice(1, None), 2)
34 | op_itemgetter = lambda x: x[:]
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter(slice(None))` instead of defining a lambda
  --> FURB118.py:33:17
   |
31 | op_itemgetter = lambda x: (x[0], x[1], x[2])
32 | op_itemgetter = lambda x: (x[1:], x[2])
33 | op_itemgetter = lambda x: x[:]
   |                 ^^^^^^^^^^^^^^
34 | op_itemgetter = lambda x: x[0, 1]
35 | op_itemgetter = lambda x: x[(0, 1)]
   |
help: Replace with `operator.itemgetter(slice(None))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
33 | op_itemgetter = lambda x: (x[1:], x[2])
   - op_itemgetter = lambda x: x[:]
34 + op_itemgetter = operator.itemgetter(slice(None))
35 | op_itemgetter = lambda x: x[0, 1]
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda
  --> FURB118.py:34:17
   |
32 | op_itemgetter = lambda x: (x[1:], x[2])
33 | op_itemgetter = lambda x: x[:]
34 | op_itemgetter = lambda x: x[0, 1]
   |                 ^^^^^^^^^^^^^^^^^
35 | op_itemgetter = lambda x: x[(0, 1)]
   |
help: Replace with `operator.itemgetter((0, 1))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
34 | op_itemgetter = lambda x: x[:]
   - op_itemgetter = lambda x: x[0, 1]
35 + op_itemgetter = operator.itemgetter((0, 1))
36 | op_itemgetter = lambda x: x[(0, 1)]
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda
  --> FURB118.py:35:17
   |
33 | op_itemgetter = lambda x: x[:]
34 | op_itemgetter = lambda x: x[0, 1]
35 | op_itemgetter = lambda x: x[(0, 1)]
   |                 ^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `operator.itemgetter((0, 1))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
35 | op_itemgetter = lambda x: x[0, 1]
   - op_itemgetter = lambda x: x[(0, 1)]
36 + op_itemgetter = operator.itemgetter((0, 1))
37 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 Use `operator.not_` instead of defining a function
  --> FURB118.py:38:5
   |
38 | def op_not2(x):
   |     ^^^^^^^
39 |     return not x
   |
help: Replace with `operator.not_`

FURB118 Use `operator.add` instead of defining a function
  --> FURB118.py:42:5
   |
42 | def op_add2(x, y):
   |     ^^^^^^^
43 |     return x + y
   |
help: Replace with `operator.add`

FURB118 [*] Use `operator.itemgetter((slice(None), 1))` instead of defining a lambda
  --> FURB118.py:88:17
   |
87 | # See https://github.com/astral-sh/ruff/issues/13508
88 | op_itemgetter = lambda x: x[:, 1]
   |                 ^^^^^^^^^^^^^^^^^
89 | op_itemgetter = lambda x: x[1, :]
   |
help: Replace with `operator.itemgetter((slice(None), 1))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
88 | # See https://github.com/astral-sh/ruff/issues/13508
   - op_itemgetter = lambda x: x[:, 1]
89 + op_itemgetter = operator.itemgetter((slice(None), 1))
90 | op_itemgetter = lambda x: x[1, :]
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter((1, slice(None)))` instead of defining a lambda
  --> FURB118.py:89:17
   |
87 | # See https://github.com/astral-sh/ruff/issues/13508
88 | op_itemgetter = lambda x: x[:, 1]
89 | op_itemgetter = lambda x: x[1, :]
   |                 ^^^^^^^^^^^^^^^^^
90 |
91 | # With a slice, trivia is dropped
   |
help: Replace with `operator.itemgetter((1, slice(None)))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
89 | op_itemgetter = lambda x: x[:, 1]
   - op_itemgetter = lambda x: x[1, :]
90 + op_itemgetter = operator.itemgetter((1, slice(None)))
91 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter((1, slice(None)))` instead of defining a lambda
  --> FURB118.py:92:17
   |
91 | # With a slice, trivia is dropped
92 | op_itemgetter = lambda x: x[1,          :]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
93 |
94 | # Without a slice, trivia is retained
   |
help: Replace with `operator.itemgetter((1, slice(None)))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
92 | # With a slice, trivia is dropped
   - op_itemgetter = lambda x: x[1,          :]
93 + op_itemgetter = operator.itemgetter((1, slice(None)))
94 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter((1,          2))` instead of defining a lambda
  --> FURB118.py:95:17
   |
94 | # Without a slice, trivia is retained
95 | op_itemgetter = lambda x: x[1,          2]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `operator.itemgetter((1,          2))`
   |
1  | # Errors.
2  + import operator
3  | op_bitnot = lambda x: ~x
--------------------------------------------------------------------------------
95 | # Without a slice, trivia is retained
   - op_itemgetter = lambda x: x[1,          2]
96 + op_itemgetter = operator.itemgetter((1,          2))
97 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter(slice(-2, None))` instead of defining a lambda
   --> FURB118.py:129:14
    |
127 |         "slicer, expected",
128 |         [
129 |             (lambda x: x[-2:], "foo"),
    |              ^^^^^^^^^^^^^^^^
130 |             (lambda x: x[-5:-3], "bar"),
131 |         ],
    |
help: Replace with `operator.itemgetter(slice(-2, None))`
    |
113 | from typing import final, override, no_type_check
114 + import operator
115 |
--------------------------------------------------------------------------------
129 |         [
    -             (lambda x: x[-2:], "foo"),
130 +             (operator.itemgetter(slice(-2, None)), "foo"),
131 |             (lambda x: x[-5:-3], "bar"),
    |
note: This is an unsafe fix and may change runtime behavior

FURB118 [*] Use `operator.itemgetter(slice(-5, -3))` instead of defining a lambda
   --> FURB118.py:130:14
    |
128 |         [
129 |             (lambda x: x[-2:], "foo"),
130 |             (lambda x: x[-5:-3], "bar"),
    |              ^^^^^^^^^^^^^^^^^^
131 |         ],
132 |     )
    |
help: Replace with `operator.itemgetter(slice(-5, -3))`
    |
113 | from typing import final, override, no_type_check
114 + import operator
115 |
--------------------------------------------------------------------------------
130 |             (lambda x: x[-2:], "foo"),
    -             (lambda x: x[-5:-3], "bar"),
131 +             (operator.itemgetter(slice(-5, -3)), "bar"),
132 |         ],
    |
note: This is an unsafe fix and may change runtime behavior
