---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF024.py:9:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
 8 | # Errors.
 9 | dict.fromkeys(pierogi_fillings, [])
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
10 | dict.fromkeys(pierogi_fillings, list())
11 | dict.fromkeys(pierogi_fillings, {})
   |
   = help: Replace with comprehension

ℹ Unsafe fix
6  6  | ]
7  7  | 
8  8  | # Errors.
9     |-dict.fromkeys(pierogi_fillings, [])
   9  |+{key: [] for key in pierogi_fillings}
10 10 | dict.fromkeys(pierogi_fillings, list())
11 11 | dict.fromkeys(pierogi_fillings, {})
12 12 | dict.fromkeys(pierogi_fillings, set())

RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
 8 | # Errors.
 9 | dict.fromkeys(pierogi_fillings, [])
10 | dict.fromkeys(pierogi_fillings, list())
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
11 | dict.fromkeys(pierogi_fillings, {})
12 | dict.fromkeys(pierogi_fillings, set())
   |
   = help: Replace with comprehension

ℹ Unsafe fix
7  7  | 
8  8  | # Errors.
9  9  | dict.fromkeys(pierogi_fillings, [])
10    |-dict.fromkeys(pierogi_fillings, list())
   10 |+{key: list() for key in pierogi_fillings}
11 11 | dict.fromkeys(pierogi_fillings, {})
12 12 | dict.fromkeys(pierogi_fillings, set())
13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})

RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
 9 | dict.fromkeys(pierogi_fillings, [])
10 | dict.fromkeys(pierogi_fillings, list())
11 | dict.fromkeys(pierogi_fillings, {})
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
12 | dict.fromkeys(pierogi_fillings, set())
13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
   |
   = help: Replace with comprehension

ℹ Unsafe fix
8  8  | # Errors.
9  9  | dict.fromkeys(pierogi_fillings, [])
10 10 | dict.fromkeys(pierogi_fillings, list())
11    |-dict.fromkeys(pierogi_fillings, {})
   11 |+{key: {} for key in pierogi_fillings}
12 12 | dict.fromkeys(pierogi_fillings, set())
13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
14 14 | dict.fromkeys(pierogi_fillings, dict())

RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
10 | dict.fromkeys(pierogi_fillings, list())
11 | dict.fromkeys(pierogi_fillings, {})
12 | dict.fromkeys(pierogi_fillings, set())
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
14 | dict.fromkeys(pierogi_fillings, dict())
   |
   = help: Replace with comprehension

ℹ Unsafe fix
9  9  | dict.fromkeys(pierogi_fillings, [])
10 10 | dict.fromkeys(pierogi_fillings, list())
11 11 | dict.fromkeys(pierogi_fillings, {})
12    |-dict.fromkeys(pierogi_fillings, set())
   12 |+{key: set() for key in pierogi_fillings}
13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
14 14 | dict.fromkeys(pierogi_fillings, dict())
15 15 | import builtins

RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
11 | dict.fromkeys(pierogi_fillings, {})
12 | dict.fromkeys(pierogi_fillings, set())
13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
14 | dict.fromkeys(pierogi_fillings, dict())
15 | import builtins
   |
   = help: Replace with comprehension

ℹ Unsafe fix
10 10 | dict.fromkeys(pierogi_fillings, list())
11 11 | dict.fromkeys(pierogi_fillings, {})
12 12 | dict.fromkeys(pierogi_fillings, set())
13    |-dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
   13 |+{key: {"pre": "populated!"} for key in pierogi_fillings}
14 14 | dict.fromkeys(pierogi_fillings, dict())
15 15 | import builtins
16 16 | builtins.dict.fromkeys(pierogi_fillings, dict())

RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
12 | dict.fromkeys(pierogi_fillings, set())
13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
14 | dict.fromkeys(pierogi_fillings, dict())
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
15 | import builtins
16 | builtins.dict.fromkeys(pierogi_fillings, dict())
   |
   = help: Replace with comprehension

ℹ Unsafe fix
11 11 | dict.fromkeys(pierogi_fillings, {})
12 12 | dict.fromkeys(pierogi_fillings, set())
13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
14    |-dict.fromkeys(pierogi_fillings, dict())
   14 |+{key: dict() for key in pierogi_fillings}
15 15 | import builtins
16 16 | builtins.dict.fromkeys(pierogi_fillings, dict())
17 17 | 

RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys`
   |
14 | dict.fromkeys(pierogi_fillings, dict())
15 | import builtins
16 | builtins.dict.fromkeys(pierogi_fillings, dict())
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024
17 |
18 | # Okay.
   |
   = help: Replace with comprehension

ℹ Unsafe fix
13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"})
14 14 | dict.fromkeys(pierogi_fillings, dict())
15 15 | import builtins
16    |-builtins.dict.fromkeys(pierogi_fillings, dict())
   16 |+{key: dict() for key in pierogi_fillings}
17 17 | 
18 18 | # Okay.
19 19 | dict.fromkeys(pierogi_fillings)
