---
source: crates/ruff_linter/src/rules/flake8_pie/mod.rs
---
PIE807 [*] Prefer `list` over useless lambda
 --> PIE807.py:3:44
  |
1 | @dataclass
2 | class Foo:
3 |     foo: List[str] = field(default_factory=lambda: [])  # PIE807
  |                                            ^^^^^^^^^^
4 |     bar: Dict[str, int] = field(default_factory=lambda: {})  # PIE807
  |
help: Replace with `lambda` with `list`
  |
2 | class Foo:
  -     foo: List[str] = field(default_factory=lambda: [])  # PIE807
3 +     foo: List[str] = field(default_factory=list)  # PIE807
4 |     bar: Dict[str, int] = field(default_factory=lambda: {})  # PIE807
  |

PIE807 [*] Prefer `dict` over useless lambda
 --> PIE807.py:4:49
  |
2 | class Foo:
3 |     foo: List[str] = field(default_factory=lambda: [])  # PIE807
4 |     bar: Dict[str, int] = field(default_factory=lambda: {})  # PIE807
  |                                                 ^^^^^^^^^^
  |
help: Replace with `lambda` with `dict`
  |
3 |     foo: List[str] = field(default_factory=lambda: [])  # PIE807
  -     bar: Dict[str, int] = field(default_factory=lambda: {})  # PIE807
4 +     bar: Dict[str, int] = field(default_factory=dict)  # PIE807
5 |
  |

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

PIE807 [*] Prefer `dict` over useless lambda
 --> PIE807.py:9:36
  |
7 | class FooTable(BaseTable):
8 |     foo = fields.ListField(default=lambda: [])  # PIE807
9 |     bar = fields.ListField(default=lambda: {})  # PIE807
  |                                    ^^^^^^^^^^
  |
help: Replace with `lambda` with `dict`
   |
8  |     foo = fields.ListField(default=lambda: [])  # PIE807
   -     bar = fields.ListField(default=lambda: {})  # PIE807
9  +     bar = fields.ListField(default=dict)  # PIE807
10 |
   |

PIE807 [*] Prefer `list` over useless lambda
  --> PIE807.py:13:28
   |
12 | class FooTable(BaseTable):
13 |     foo = fields.ListField(lambda: [])  # PIE807
   |                            ^^^^^^^^^^
14 |     bar = fields.ListField(default=lambda: {})  # PIE807
   |
help: Replace with `lambda` with `list`
   |
12 | class FooTable(BaseTable):
   -     foo = fields.ListField(lambda: [])  # PIE807
13 +     foo = fields.ListField(list)  # PIE807
14 |     bar = fields.ListField(default=lambda: {})  # PIE807
   |

PIE807 [*] Prefer `dict` over useless lambda
  --> PIE807.py:14:36
   |
12 | class FooTable(BaseTable):
13 |     foo = fields.ListField(lambda: [])  # PIE807
14 |     bar = fields.ListField(default=lambda: {})  # PIE807
   |                                    ^^^^^^^^^^
   |
help: Replace with `lambda` with `dict`
   |
13 |     foo = fields.ListField(lambda: [])  # PIE807
   -     bar = fields.ListField(default=lambda: {})  # PIE807
14 +     bar = fields.ListField(default=dict)  # PIE807
15 |
   |
