---
source: crates/ruff_linter/src/rules/flake8_pie/mod.rs
---
PIE804 [*] Unnecessary `dict` kwargs
 --> PIE804.py:1:5
  |
1 | foo(**{"bar": True})  # PIE804
  |     ^^^^^^^^^^^^^^^
2 |
3 | foo(**{"r2d2": True})  # PIE804
  |
help: Remove unnecessary kwargs
  |
  - foo(**{"bar": True})  # PIE804
1 + foo(bar=True)  # PIE804
2 |
  |

PIE804 [*] Unnecessary `dict` kwargs
 --> PIE804.py:3:5
  |
1 | foo(**{"bar": True})  # PIE804
2 |
3 | foo(**{"r2d2": True})  # PIE804
  |     ^^^^^^^^^^^^^^^^
4 |
5 | Foo.objects.create(**{"bar": True})  # PIE804
  |
help: Remove unnecessary kwargs
  |
2 |
  - foo(**{"r2d2": True})  # PIE804
3 + foo(r2d2=True)  # PIE804
4 |
  |

PIE804 [*] Unnecessary `dict` kwargs
 --> PIE804.py:5:20
  |
3 | foo(**{"r2d2": True})  # PIE804
4 |
5 | Foo.objects.create(**{"bar": True})  # PIE804
  |                    ^^^^^^^^^^^^^^^
6 |
7 | Foo.objects.create(**{"_id": some_id})  # PIE804
  |
help: Remove unnecessary kwargs
  |
4 |
  - Foo.objects.create(**{"bar": True})  # PIE804
5 + Foo.objects.create(bar=True)  # PIE804
6 |
  |

PIE804 [*] Unnecessary `dict` kwargs
 --> PIE804.py:7:20
  |
5 | Foo.objects.create(**{"bar": True})  # PIE804
6 |
7 | Foo.objects.create(**{"_id": some_id})  # PIE804
  |                    ^^^^^^^^^^^^^^^^^^
8 |
9 | Foo.objects.create(**{**bar})  # PIE804
  |
help: Remove unnecessary kwargs
  |
6 |
  - Foo.objects.create(**{"_id": some_id})  # PIE804
7 + Foo.objects.create(_id=some_id)  # PIE804
8 |
  |

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:9:20
   |
 7 | Foo.objects.create(**{"_id": some_id})  # PIE804
 8 |
 9 | Foo.objects.create(**{**bar})  # PIE804
   |                    ^^^^^^^^^
10 |
11 | foo(**{})
   |
help: Remove unnecessary kwargs
   |
8  |
   - Foo.objects.create(**{**bar})  # PIE804
9  + Foo.objects.create(**bar)  # PIE804
10 |
   |

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:11:5
   |
 9 | Foo.objects.create(**{**bar})  # PIE804
10 |
11 | foo(**{})
   |     ^^^^
12 |
13 | foo(**{**data, "foo": "buzz"})
   |
help: Remove unnecessary kwargs
   |
10 |
   - foo(**{})
11 + foo()
12 |
   |

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:22:5
   |
20 | foo(**{f"buzz__{bar}": True})
21 | abc(**{"for": 3})
22 | foo(**{},)
   |     ^^^^
23 |
24 | # Duplicated key names won't be fixed, to avoid syntax errors.
   |
help: Remove unnecessary kwargs
   |
21 | abc(**{"for": 3})
   - foo(**{},)
22 + foo()
23 |
   |

PIE804 Unnecessary `dict` kwargs
  --> PIE804.py:25:5
   |
24 | # Duplicated key names won't be fixed, to avoid syntax errors.
25 | abc(**{'a': b}, **{'a': c})  # PIE804
   |     ^^^^^^^^^^
26 | abc(a=1, **{'a': c}, **{'b': c})  # PIE804
   |
help: Remove unnecessary kwargs

PIE804 Unnecessary `dict` kwargs
  --> PIE804.py:25:17
   |
24 | # Duplicated key names won't be fixed, to avoid syntax errors.
25 | abc(**{'a': b}, **{'a': c})  # PIE804
   |                 ^^^^^^^^^^
26 | abc(a=1, **{'a': c}, **{'b': c})  # PIE804
   |
help: Remove unnecessary kwargs

PIE804 Unnecessary `dict` kwargs
  --> PIE804.py:26:10
   |
24 | # Duplicated key names won't be fixed, to avoid syntax errors.
25 | abc(**{'a': b}, **{'a': c})  # PIE804
26 | abc(a=1, **{'a': c}, **{'b': c})  # PIE804
   |          ^^^^^^^^^^
27 |
28 | # Some values need to be parenthesized.
   |
help: Remove unnecessary kwargs

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:26:22
   |
24 | # Duplicated key names won't be fixed, to avoid syntax errors.
25 | abc(**{'a': b}, **{'a': c})  # PIE804
26 | abc(a=1, **{'a': c}, **{'b': c})  # PIE804
   |                      ^^^^^^^^^^
27 |
28 | # Some values need to be parenthesized.
   |
help: Remove unnecessary kwargs
   |
25 | abc(**{'a': b}, **{'a': c})  # PIE804
   - abc(a=1, **{'a': c}, **{'b': c})  # PIE804
26 + abc(a=1, **{'a': c}, b=c)  # PIE804
27 |
   |

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:30:16
   |
28 | # Some values need to be parenthesized.
29 | def foo():
30 |     abc(foo=1, **{'bar': (bar := 1)})  # PIE804
   |                ^^^^^^^^^^^^^^^^^^^^^
31 |     abc(foo=1, **{'bar': (yield 1)})  # PIE804
   |
help: Remove unnecessary kwargs
   |
29 | def foo():
   -     abc(foo=1, **{'bar': (bar := 1)})  # PIE804
30 +     abc(foo=1, bar=(bar := 1))  # PIE804
31 |     abc(foo=1, **{'bar': (yield 1)})  # PIE804
   |

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:31:16
   |
29 | def foo():
30 |     abc(foo=1, **{'bar': (bar := 1)})  # PIE804
31 |     abc(foo=1, **{'bar': (yield 1)})  # PIE804
   |                ^^^^^^^^^^^^^^^^^^^^
32 |
33 | # https://github.com/astral-sh/ruff/issues/18036
   |
help: Remove unnecessary kwargs
   |
30 |     abc(foo=1, **{'bar': (bar := 1)})  # PIE804
   -     abc(foo=1, **{'bar': (yield 1)})  # PIE804
31 +     abc(foo=1, bar=(yield 1))  # PIE804
32 |
   |

PIE804 [*] Unnecessary `dict` kwargs
  --> PIE804.py:36:5
   |
34 |   # The autofix for this is unsafe due to the comments inside the dictionary.
35 |   foo(
36 | /     **{
37 | |         # Comment 1
38 | |         "x": 1.0,
39 | |         # Comment 2
40 | |         "y": 2.0,
41 | |     }
   | |_____^
42 |   )
   |
help: Remove unnecessary kwargs
   |
35 | foo(
   -     **{
   -         # Comment 1
   -         "x": 1.0,
   -         # Comment 2
   -         "y": 2.0,
   -     }
36 +     x=1.0, y=2.0
37 | )
   |
note: This is an unsafe fix and may change runtime behavior
