---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C405 [*] Unnecessary list literal (rewrite as a set literal)
 --> C405.py:1:1
  |
1 | set([1, 2])
  | ^^^^^^^^^^^
2 | set((1, 2))
3 | set([])
  |
help: Rewrite as a set literal
  |
  - set([1, 2])
1 + {1, 2}
2 | set((1, 2))
  |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary tuple literal (rewrite as a set literal)
 --> C405.py:2:1
  |
1 | set([1, 2])
2 | set((1, 2))
  | ^^^^^^^^^^^
3 | set([])
4 | set(())
  |
help: Rewrite as a set literal
  |
1 | set([1, 2])
  - set((1, 2))
2 + {1, 2}
3 | set([])
  |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
 --> C405.py:3:1
  |
1 | set([1, 2])
2 | set((1, 2))
3 | set([])
  | ^^^^^^^
4 | set(())
5 | set()
  |
help: Rewrite as a set literal
  |
2 | set((1, 2))
  - set([])
3 + set()
4 | set(())
  |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary tuple literal (rewrite as a set literal)
 --> C405.py:4:1
  |
2 | set((1, 2))
3 | set([])
4 | set(())
  | ^^^^^^^
5 | set()
6 | set((1,))
  |
help: Rewrite as a set literal
  |
3 | set([])
  - set(())
4 | set()
5 + set()
6 | set((1,))
  |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary tuple literal (rewrite as a set literal)
 --> C405.py:6:1
  |
4 | set(())
5 | set()
6 | set((1,))
  | ^^^^^^^^^
7 | set((
8 |     1,
  |
help: Rewrite as a set literal
  |
5 | set()
  - set((1,))
6 + {1}
7 | set((
  |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary tuple literal (rewrite as a set literal)
  --> C405.py:7:1
   |
 5 |   set()
 6 |   set((1,))
 7 | / set((
 8 | |     1,
 9 | | ))
   | |__^
10 |   set([
11 |       1,
   |
help: Rewrite as a set literal
   |
6  | set((1,))
   - set((
7  + {
8  |     1,
   - ))
9  + }
10 | set([
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:10:1
   |
 8 |       1,
 9 |   ))
10 | / set([
11 | |     1,
12 | | ])
   | |__^
13 |   set(
14 |       (1,)
   |
help: Rewrite as a set literal
   |
9  | ))
   - set([
10 + {
11 |     1,
   - ])
12 + }
13 | set(
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary tuple literal (rewrite as a set literal)
  --> C405.py:13:1
   |
11 |       1,
12 |   ])
13 | / set(
14 | |     (1,)
15 | | )
   | |_^
16 |   set(
17 |       [1,]
   |
help: Rewrite as a set literal
   |
12 | ])
   - set(
   -     (1,)
   - )
13 + {1}
14 | set(
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:16:1
   |
14 |       (1,)
15 |   )
16 | / set(
17 | |     [1,]
18 | | )
   | |_^
19 |   f"{set([1,2,3])}"
20 |   f"{set(['a', 'b'])}"
   |
help: Rewrite as a set literal
   |
15 | )
   - set(
   -     [1,]
   - )
16 + {1,}
17 | f"{set([1,2,3])}"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:19:4
   |
17 |     [1,]
18 | )
19 | f"{set([1,2,3])}"
   |    ^^^^^^^^^^^^
20 | f"{set(['a', 'b'])}"
21 | f'{set(["a", "b"])}'
   |
help: Rewrite as a set literal
   |
18 | )
   - f"{set([1,2,3])}"
19 + f"{ {1,2,3} }"
20 | f"{set(['a', 'b'])}"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:20:4
   |
18 | )
19 | f"{set([1,2,3])}"
20 | f"{set(['a', 'b'])}"
   |    ^^^^^^^^^^^^^^^
21 | f'{set(["a", "b"])}'
   |
help: Rewrite as a set literal
   |
19 | f"{set([1,2,3])}"
   - f"{set(['a', 'b'])}"
20 + f"{ {'a', 'b'} }"
21 | f'{set(["a", "b"])}'
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:21:4
   |
19 | f"{set([1,2,3])}"
20 | f"{set(['a', 'b'])}"
21 | f'{set(["a", "b"])}'
   |    ^^^^^^^^^^^^^^^
22 |
23 | f"{set(['a', 'b']) - set(['a'])}"
   |
help: Rewrite as a set literal
   |
20 | f"{set(['a', 'b'])}"
   - f'{set(["a", "b"])}'
21 + f'{ {"a", "b"} }'
22 |
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:23:4
   |
21 | f'{set(["a", "b"])}'
22 |
23 | f"{set(['a', 'b']) - set(['a'])}"
   |    ^^^^^^^^^^^^^^^
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   |
help: Rewrite as a set literal
   |
22 |
   - f"{set(['a', 'b']) - set(['a'])}"
23 + f"{ {'a', 'b'} - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:23:22
   |
21 | f'{set(["a", "b"])}'
22 |
23 | f"{set(['a', 'b']) - set(['a'])}"
   |                      ^^^^^^^^^^
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   |
help: Rewrite as a set literal
   |
22 |
   - f"{set(['a', 'b']) - set(['a'])}"
23 + f"{set(['a', 'b']) - {'a'} }"
24 | f"{ set(['a', 'b']) - set(['a']) }"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:24:5
   |
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
   |     ^^^^^^^^^^^^^^^
25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
23 | f"{set(['a', 'b']) - set(['a'])}"
   - f"{ set(['a', 'b']) - set(['a']) }"
24 + f"{ {'a', 'b'} - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:24:23
   |
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
   |                       ^^^^^^^^^^
25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
23 | f"{set(['a', 'b']) - set(['a'])}"
   - f"{ set(['a', 'b']) - set(['a']) }"
24 + f"{ set(['a', 'b']) - {'a'} }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:25:6
   |
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   |      ^^^^^^^^^^^^^^^
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
24 | f"{ set(['a', 'b']) - set(['a']) }"
   - f"a {set(['a', 'b']) - set(['a'])} b"
25 + f"a { {'a', 'b'} - set(['a'])} b"
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:25:24
   |
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   |                        ^^^^^^^^^^
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
24 | f"{ set(['a', 'b']) - set(['a']) }"
   - f"a {set(['a', 'b']) - set(['a'])} b"
25 + f"a {set(['a', 'b']) - {'a'} } b"
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:26:7
   |
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |       ^^^^^^^^^^^^^^^
27 |
28 | t"{set([1,2,3])}"
   |
help: Rewrite as a set literal
   |
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   - f"a { set(['a', 'b']) - set(['a']) } b"
26 + f"a { {'a', 'b'} - set(['a']) } b"
27 |
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:26:25
   |
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 | f"a { set(['a', 'b']) - set(['a']) } b"
   |                         ^^^^^^^^^^
27 |
28 | t"{set([1,2,3])}"
   |
help: Rewrite as a set literal
   |
25 | f"a {set(['a', 'b']) - set(['a'])} b"
   - f"a { set(['a', 'b']) - set(['a']) } b"
26 + f"a { set(['a', 'b']) - {'a'} } b"
27 |
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:28:4
   |
26 | f"a { set(['a', 'b']) - set(['a']) } b"
27 |
28 | t"{set([1,2,3])}"
   |    ^^^^^^^^^^^^
29 | t"{set(['a', 'b'])}"
30 | t'{set(["a", "b"])}'
   |
help: Rewrite as a set literal
   |
27 |
   - t"{set([1,2,3])}"
28 + t"{ {1,2,3} }"
29 | t"{set(['a', 'b'])}"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:29:4
   |
28 | t"{set([1,2,3])}"
29 | t"{set(['a', 'b'])}"
   |    ^^^^^^^^^^^^^^^
30 | t'{set(["a", "b"])}'
   |
help: Rewrite as a set literal
   |
28 | t"{set([1,2,3])}"
   - t"{set(['a', 'b'])}"
29 + t"{ {'a', 'b'} }"
30 | t'{set(["a", "b"])}'
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:30:4
   |
28 | t"{set([1,2,3])}"
29 | t"{set(['a', 'b'])}"
30 | t'{set(["a", "b"])}'
   |    ^^^^^^^^^^^^^^^
31 |
32 | t"{set(['a', 'b']) - set(['a'])}"
   |
help: Rewrite as a set literal
   |
29 | t"{set(['a', 'b'])}"
   - t'{set(["a", "b"])}'
30 + t'{ {"a", "b"} }'
31 |
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:32:4
   |
30 | t'{set(["a", "b"])}'
31 |
32 | t"{set(['a', 'b']) - set(['a'])}"
   |    ^^^^^^^^^^^^^^^
33 | t"{ set(['a', 'b']) - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   |
help: Rewrite as a set literal
   |
31 |
   - t"{set(['a', 'b']) - set(['a'])}"
32 + t"{ {'a', 'b'} - set(['a'])}"
33 | t"{ set(['a', 'b']) - set(['a']) }"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:32:22
   |
30 | t'{set(["a", "b"])}'
31 |
32 | t"{set(['a', 'b']) - set(['a'])}"
   |                      ^^^^^^^^^^
33 | t"{ set(['a', 'b']) - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   |
help: Rewrite as a set literal
   |
31 |
   - t"{set(['a', 'b']) - set(['a'])}"
32 + t"{set(['a', 'b']) - {'a'} }"
33 | t"{ set(['a', 'b']) - set(['a']) }"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:33:5
   |
32 | t"{set(['a', 'b']) - set(['a'])}"
33 | t"{ set(['a', 'b']) - set(['a']) }"
   |     ^^^^^^^^^^^^^^^
34 | t"a {set(['a', 'b']) - set(['a'])} b"
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
32 | t"{set(['a', 'b']) - set(['a'])}"
   - t"{ set(['a', 'b']) - set(['a']) }"
33 + t"{ {'a', 'b'} - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:33:23
   |
32 | t"{set(['a', 'b']) - set(['a'])}"
33 | t"{ set(['a', 'b']) - set(['a']) }"
   |                       ^^^^^^^^^^
34 | t"a {set(['a', 'b']) - set(['a'])} b"
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
32 | t"{set(['a', 'b']) - set(['a'])}"
   - t"{ set(['a', 'b']) - set(['a']) }"
33 + t"{ set(['a', 'b']) - {'a'} }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:34:6
   |
32 | t"{set(['a', 'b']) - set(['a'])}"
33 | t"{ set(['a', 'b']) - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   |      ^^^^^^^^^^^^^^^
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
33 | t"{ set(['a', 'b']) - set(['a']) }"
   - t"a {set(['a', 'b']) - set(['a'])} b"
34 + t"a { {'a', 'b'} - set(['a'])} b"
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:34:24
   |
32 | t"{set(['a', 'b']) - set(['a'])}"
33 | t"{ set(['a', 'b']) - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   |                        ^^^^^^^^^^
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |
help: Rewrite as a set literal
   |
33 | t"{ set(['a', 'b']) - set(['a']) }"
   - t"a {set(['a', 'b']) - set(['a'])} b"
34 + t"a {set(['a', 'b']) - {'a'} } b"
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:35:7
   |
33 | t"{ set(['a', 'b']) - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |       ^^^^^^^^^^^^^^^
   |
help: Rewrite as a set literal
   |
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   - t"a { set(['a', 'b']) - set(['a']) } b"
35 + t"a { {'a', 'b'} - set(['a']) } b"
   |
note: This is an unsafe fix and may change runtime behavior

C405 [*] Unnecessary list literal (rewrite as a set literal)
  --> C405.py:35:25
   |
33 | t"{ set(['a', 'b']) - set(['a']) }"
34 | t"a {set(['a', 'b']) - set(['a'])} b"
35 | t"a { set(['a', 'b']) - set(['a']) } b"
   |                         ^^^^^^^^^^
   |
help: Rewrite as a set literal
   |
34 | t"a {set(['a', 'b']) - set(['a'])} b"
   - t"a { set(['a', 'b']) - set(['a']) } b"
35 + t"a { set(['a', 'b']) - {'a'} } b"
   |
note: This is an unsafe fix and may change runtime behavior
