---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C408.py:1:5: C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
  |
1 | t = tuple()
  |     ^^^^^^^ C408
2 | l = list()
3 | d1 = dict()
  |
  = help: Rewrite as a literal

ℹ Unsafe fix
1   |-t = tuple()
  1 |+t = ()
2 2 | l = list()
3 3 | d1 = dict()
4 4 | d2 = dict(a=1)

C408.py:2:5: C408 [*] Unnecessary `list()` call (rewrite as a literal)
  |
1 | t = tuple()
2 | l = list()
  |     ^^^^^^ C408
3 | d1 = dict()
4 | d2 = dict(a=1)
  |
  = help: Rewrite as a literal

ℹ Unsafe fix
1 1 | t = tuple()
2   |-l = list()
  2 |+l = []
3 3 | d1 = dict()
4 4 | d2 = dict(a=1)
5 5 | d3 = dict(**d2)

C408.py:3:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal)
  |
1 | t = tuple()
2 | l = list()
3 | d1 = dict()
  |      ^^^^^^ C408
4 | d2 = dict(a=1)
5 | d3 = dict(**d2)
  |
  = help: Rewrite as a literal

ℹ Unsafe fix
1 1 | t = tuple()
2 2 | l = list()
3   |-d1 = dict()
  3 |+d1 = {}
4 4 | d2 = dict(a=1)
5 5 | d3 = dict(**d2)
6 6 | 

C408.py:16:4: C408 [*] Unnecessary `dict()` call (rewrite as a literal)
   |
14 | f"{dict(x='y')}"
15 | f'{dict(x="y")}'
16 | f"{dict()}"
   |    ^^^^^^ C408
17 | f"a {dict()} b"
   |
   = help: Rewrite as a literal

ℹ Unsafe fix
13 13 | 
14 14 | f"{dict(x='y')}"
15 15 | f'{dict(x="y")}'
16    |-f"{dict()}"
   16 |+f"{ {} }"
17 17 | f"a {dict()} b"
18 18 | 
19 19 | f"{dict(x='y') | dict(y='z')}"

C408.py:17:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal)
   |
15 | f'{dict(x="y")}'
16 | f"{dict()}"
17 | f"a {dict()} b"
   |      ^^^^^^ C408
18 | 
19 | f"{dict(x='y') | dict(y='z')}"
   |
   = help: Rewrite as a literal

ℹ Unsafe fix
14 14 | f"{dict(x='y')}"
15 15 | f'{dict(x="y")}'
16 16 | f"{dict()}"
17    |-f"a {dict()} b"
   17 |+f"a { {} } b"
18 18 | 
19 19 | f"{dict(x='y') | dict(y='z')}"
20 20 | f"{ dict(x='y') | dict(y='z') }"

C408.py:24:1: C408 [*] Unnecessary `dict()` call (rewrite as a literal)
   |
22 |   f"a { dict(x='y') | dict(y='z') } b"
23 |   
24 | / dict(
25 | |     # comment
26 | | )
   | |_^ C408
27 |   
28 |   tuple(  # comment
   |
   = help: Rewrite as a literal

ℹ Unsafe fix
21 21 | f"a {dict(x='y') | dict(y='z')} b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
23 23 | 
24    |-dict(
   24 |+{
25 25 |     # comment
26    |-)
   26 |+}
27 27 | 
28 28 | tuple(  # comment
29 29 | )

C408.py:28:1: C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
   |
26 |   )
27 |   
28 | / tuple(  # comment
29 | | )
   | |_^ C408
   |
   = help: Rewrite as a literal

ℹ Unsafe fix
25 25 |     # comment
26 26 | )
27 27 | 
28    |-tuple(  # comment
   28 |+(  # comment
29 29 | )
