---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C414 [*] Unnecessary `list()` call within `list()`
 --> C414.py:2:1
  |
1 | x = [1, 2, 3]
2 | list(list(x))
  | ^^^^^^^^^^^^^
3 | list(tuple(x))
4 | tuple(list(x))
  |
help: Remove the inner `list()` call
  |
1 | x = [1, 2, 3]
  - list(list(x))
2 + list(x)
3 | list(tuple(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `tuple()` call within `list()`
 --> C414.py:3:1
  |
1 | x = [1, 2, 3]
2 | list(list(x))
3 | list(tuple(x))
  | ^^^^^^^^^^^^^^
4 | tuple(list(x))
5 | tuple(tuple(x))
  |
help: Remove the inner `tuple()` call
  |
2 | list(list(x))
  - list(tuple(x))
3 + list(x)
4 | tuple(list(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `tuple()`
 --> C414.py:4:1
  |
2 | list(list(x))
3 | list(tuple(x))
4 | tuple(list(x))
  | ^^^^^^^^^^^^^^
5 | tuple(tuple(x))
6 | set(set(x))
  |
help: Remove the inner `list()` call
  |
3 | list(tuple(x))
  - tuple(list(x))
4 + tuple(x)
5 | tuple(tuple(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `tuple()` call within `tuple()`
 --> C414.py:5:1
  |
3 | list(tuple(x))
4 | tuple(list(x))
5 | tuple(tuple(x))
  | ^^^^^^^^^^^^^^^
6 | set(set(x))
7 | set(list(x))
  |
help: Remove the inner `tuple()` call
  |
4 | tuple(list(x))
  - tuple(tuple(x))
5 + tuple(x)
6 | set(set(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `set()` call within `set()`
 --> C414.py:6:1
  |
4 | tuple(list(x))
5 | tuple(tuple(x))
6 | set(set(x))
  | ^^^^^^^^^^^
7 | set(list(x))
8 | set(tuple(x))
  |
help: Remove the inner `set()` call
  |
5 | tuple(tuple(x))
  - set(set(x))
6 + set(x)
7 | set(list(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `set()`
 --> C414.py:7:1
  |
5 | tuple(tuple(x))
6 | set(set(x))
7 | set(list(x))
  | ^^^^^^^^^^^^
8 | set(tuple(x))
9 | set(sorted(x))
  |
help: Remove the inner `list()` call
  |
6 | set(set(x))
  - set(list(x))
7 + set(x)
8 | set(tuple(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `tuple()` call within `set()`
  --> C414.py:8:1
   |
 6 | set(set(x))
 7 | set(list(x))
 8 | set(tuple(x))
   | ^^^^^^^^^^^^^
 9 | set(sorted(x))
10 | set(sorted(x, key=lambda y: y))
   |
help: Remove the inner `tuple()` call
  |
7 | set(list(x))
  - set(tuple(x))
8 + set(x)
9 | set(sorted(x))
  |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `sorted()` call within `set()`
  --> C414.py:9:1
   |
 7 | set(list(x))
 8 | set(tuple(x))
 9 | set(sorted(x))
   | ^^^^^^^^^^^^^^
10 | set(sorted(x, key=lambda y: y))
11 | set(reversed(x))
   |
help: Remove the inner `sorted()` call
   |
8  | set(tuple(x))
   - set(sorted(x))
9  + set(x)
10 | set(sorted(x, key=lambda y: y))
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `sorted()` call within `set()`
  --> C414.py:10:1
   |
 8 | set(tuple(x))
 9 | set(sorted(x))
10 | set(sorted(x, key=lambda y: y))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 | set(reversed(x))
12 | sorted(list(x))
   |
help: Remove the inner `sorted()` call
   |
9  | set(sorted(x))
   - set(sorted(x, key=lambda y: y))
10 + set(x)
11 | set(reversed(x))
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `reversed()` call within `set()`
  --> C414.py:11:1
   |
 9 | set(sorted(x))
10 | set(sorted(x, key=lambda y: y))
11 | set(reversed(x))
   | ^^^^^^^^^^^^^^^^
12 | sorted(list(x))
13 | sorted(tuple(x))
   |
help: Remove the inner `reversed()` call
   |
10 | set(sorted(x, key=lambda y: y))
   - set(reversed(x))
11 + set(x)
12 | sorted(list(x))
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `sorted()`
  --> C414.py:12:1
   |
10 | set(sorted(x, key=lambda y: y))
11 | set(reversed(x))
12 | sorted(list(x))
   | ^^^^^^^^^^^^^^^
13 | sorted(tuple(x))
14 | sorted(sorted(x))
   |
help: Remove the inner `list()` call
   |
11 | set(reversed(x))
   - sorted(list(x))
12 + sorted(x)
13 | sorted(tuple(x))
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `tuple()` call within `sorted()`
  --> C414.py:13:1
   |
11 | set(reversed(x))
12 | sorted(list(x))
13 | sorted(tuple(x))
   | ^^^^^^^^^^^^^^^^
14 | sorted(sorted(x))
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
   |
help: Remove the inner `tuple()` call
   |
12 | sorted(list(x))
   - sorted(tuple(x))
13 + sorted(x)
14 | sorted(sorted(x))
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `sorted()` call within `sorted()`
  --> C414.py:14:1
   |
12 | sorted(list(x))
13 | sorted(tuple(x))
14 | sorted(sorted(x))
   | ^^^^^^^^^^^^^^^^^
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
16 | sorted(sorted(x, reverse=True), reverse=True)
   |
help: Remove the inner `sorted()` call
   |
13 | sorted(tuple(x))
   - sorted(sorted(x))
14 + sorted(x)
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `sorted()` call within `sorted()`
  --> C414.py:15:1
   |
13 | sorted(tuple(x))
14 | sorted(sorted(x))
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 | sorted(sorted(x, reverse=True), reverse=True)
17 | sorted(reversed(x))
   |
help: Remove the inner `sorted()` call
   |
14 | sorted(sorted(x))
   - sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
15 + sorted(x, reverse=False, key=foo)
16 | sorted(sorted(x, reverse=True), reverse=True)
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `sorted()` call within `sorted()`
  --> C414.py:16:1
   |
14 | sorted(sorted(x))
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
16 | sorted(sorted(x, reverse=True), reverse=True)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 | sorted(reversed(x))
18 | sorted(list(x), key=lambda y: y)
   |
help: Remove the inner `sorted()` call
   |
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
   - sorted(sorted(x, reverse=True), reverse=True)
16 + sorted(x, reverse=True)
17 | sorted(reversed(x))
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `reversed()` call within `sorted()`
  --> C414.py:17:1
   |
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
16 | sorted(sorted(x, reverse=True), reverse=True)
17 | sorted(reversed(x))
   | ^^^^^^^^^^^^^^^^^^^
18 | sorted(list(x), key=lambda y: y)
19 | tuple(
   |
help: Remove the inner `reversed()` call
   |
16 | sorted(sorted(x, reverse=True), reverse=True)
   - sorted(reversed(x))
17 + sorted(x)
18 | sorted(list(x), key=lambda y: y)
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `sorted()`
  --> C414.py:18:1
   |
16 | sorted(sorted(x, reverse=True), reverse=True)
17 | sorted(reversed(x))
18 | sorted(list(x), key=lambda y: y)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 | tuple(
20 |     list(
   |
help: Remove the inner `list()` call
   |
17 | sorted(reversed(x))
   - sorted(list(x), key=lambda y: y)
18 + sorted(x, key=lambda y: y)
19 | tuple(
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `tuple()`
  --> C414.py:19:1
   |
17 |   sorted(reversed(x))
18 |   sorted(list(x), key=lambda y: y)
19 | / tuple(
20 | |     list(
21 | |         [x, 3, "hell"\
22 | |         "o"]
23 | |     )
24 | | )
   | |_^
25 |   set(set())
26 |   set(list())
   |
help: Remove the inner `list()` call
   |
19 | tuple(
   -     list(
   -         [x, 3, "hell"\
20 +     [x, 3, "hell"\
21 |         "o"]
   -     )
22 | )
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `set()` call within `set()`
  --> C414.py:25:1
   |
23 |     )
24 | )
25 | set(set())
   | ^^^^^^^^^^
26 | set(list())
27 | set(tuple())
   |
help: Remove the inner `set()` call
   |
24 | )
   - set(set())
25 + set()
26 | set(list())
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `set()`
  --> C414.py:26:1
   |
24 | )
25 | set(set())
26 | set(list())
   | ^^^^^^^^^^^
27 | set(tuple())
28 | sorted(reversed())
   |
help: Remove the inner `list()` call
   |
25 | set(set())
   - set(list())
26 + set()
27 | set(tuple())
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `tuple()` call within `set()`
  --> C414.py:27:1
   |
25 | set(set())
26 | set(list())
27 | set(tuple())
   | ^^^^^^^^^^^^
28 | sorted(reversed())
   |
help: Remove the inner `tuple()` call
   |
26 | set(list())
   - set(tuple())
27 + set()
28 | sorted(reversed())
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `reversed()` call within `sorted()`
  --> C414.py:28:1
   |
26 | set(list())
27 | set(tuple())
28 | sorted(reversed())
   | ^^^^^^^^^^^^^^^^^^
29 |
30 | # Nested sorts with differing keyword arguments. Not flagged.
   |
help: Remove the inner `reversed()` call
   |
27 | set(tuple())
   - sorted(reversed())
28 + sorted()
29 |
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `sorted()`
  --> C414.py:37:27
   |
36 |   # Preserve trailing comments.
37 |   xxxxxxxxxxx_xxxxx_xxxxx = sorted(
   |  ___________________________^
38 | |     list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()),
39 | |     # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx, xxx xxxxxx3 xxxxxxxxx xx
40 | |     # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx
41 | |     key=lambda xxxxx: xxxxx or "",
42 | | )
   | |_^
43 |
44 |   xxxxxxxxxxx_xxxxx_xxxxx = sorted(
   |
help: Remove the inner `list()` call
   |
37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
   -     list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()),
38 +     x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(),
39 |     # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx, xxx xxxxxx3 xxxxxxxxx xx
   |
note: This is an unsafe fix and may change runtime behavior

C414 [*] Unnecessary `list()` call within `sorted()`
  --> C414.py:44:27
   |
42 |   )
43 |
44 |   xxxxxxxxxxx_xxxxx_xxxxx = sorted(
   |  ___________________________^
45 | |     list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()),  # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
46 | |     key=lambda xxxxx: xxxxx or "",
47 | | )
   | |_^
   |
help: Remove the inner `list()` call
   |
44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
   -     list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()),  # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
45 +     x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(),  # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
46 |     key=lambda xxxxx: xxxxx or "",
   |
note: This is an unsafe fix and may change runtime behavior
