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

C406 [*] Unnecessary tuple literal (rewrite as a dict literal)
 --> C406.py:2:6
  |
1 | d1 = dict([(1, 2)])
2 | d2 = dict(((1, 2),))
  |      ^^^^^^^^^^^^^^^
3 | d3 = dict([])
4 | d4 = dict(())
  |
help: Rewrite as a dict literal
  |
1 | d1 = dict([(1, 2)])
  - d2 = dict(((1, 2),))
2 + d2 = {1: 2,}
3 | d3 = dict([])
  |
note: This is an unsafe fix and may change runtime behavior

C406 [*] Unnecessary list literal (rewrite as a dict literal)
 --> C406.py:3:6
  |
1 | d1 = dict([(1, 2)])
2 | d2 = dict(((1, 2),))
3 | d3 = dict([])
  |      ^^^^^^^^
4 | d4 = dict(())
5 | d5 = dict()
  |
help: Rewrite as a dict literal
  |
2 | d2 = dict(((1, 2),))
  - d3 = dict([])
3 + d3 = {}
4 | d4 = dict(())
  |
note: This is an unsafe fix and may change runtime behavior

C406 [*] Unnecessary tuple literal (rewrite as a dict literal)
 --> C406.py:4:6
  |
2 | d2 = dict(((1, 2),))
3 | d3 = dict([])
4 | d4 = dict(())
  |      ^^^^^^^^
5 | d5 = dict()
  |
help: Rewrite as a dict literal
  |
3 | d3 = dict([])
  - d4 = dict(())
4 + d4 = {}
5 | d5 = dict()
  |
note: This is an unsafe fix and may change runtime behavior
