---
source: crates/ruff/src/rules/flake8_pie/mod.rs
---
PIE807.py:3:44: PIE807 [*] Prefer `list` over useless lambda
  |
3 | @dataclass
4 | class Foo:
5 |     foo: List[str] = field(default_factory=lambda: [])  # PIE807
  |                                            ^^^^^^^^^^ PIE807
  |
  = help: Replace with `list`

ℹ Suggested fix
1 1 | @dataclass
2 2 | class Foo:
3   |-    foo: List[str] = field(default_factory=lambda: [])  # PIE807
  3 |+    foo: List[str] = field(default_factory=list)  # PIE807
4 4 | 
5 5 | 
6 6 | class FooTable(BaseTable):

PIE807.py:7:36: PIE807 [*] Prefer `list` over useless lambda
  |
7 | class FooTable(BaseTable):
8 |     bar = fields.ListField(default=lambda: [])  # PIE807
  |                                    ^^^^^^^^^^ PIE807
  |
  = help: Replace with `list`

ℹ Suggested fix
4 4 | 
5 5 | 
6 6 | class FooTable(BaseTable):
7   |-    bar = fields.ListField(default=lambda: [])  # PIE807
  7 |+    bar = fields.ListField(default=list)  # PIE807
8 8 | 
9 9 | 
10 10 | class FooTable(BaseTable):

PIE807.py:11:28: PIE807 [*] Prefer `list` over useless lambda
   |
11 | class FooTable(BaseTable):
12 |     bar = fields.ListField(lambda: [])  # PIE807
   |                            ^^^^^^^^^^ PIE807
   |
   = help: Replace with `list`

ℹ Suggested fix
8  8  | 
9  9  | 
10 10 | class FooTable(BaseTable):
11    |-    bar = fields.ListField(lambda: [])  # PIE807
   11 |+    bar = fields.ListField(list)  # PIE807
12 12 | 
13 13 | 
14 14 | @dataclass


