---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:11:5
   |
10 | def func():
11 |     defaultdict(default_factory=int)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=int)`
   |
10 | def func():
   -     defaultdict(default_factory=int)  # RUF026
11 +     defaultdict(int)  # RUF026
12 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:15:5
   |
14 | def func():
15 |     defaultdict(default_factory=float)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=float)`
   |
14 | def func():
   -     defaultdict(default_factory=float)  # RUF026
15 +     defaultdict(float)  # RUF026
16 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:19:5
   |
18 | def func():
19 |     defaultdict(default_factory=dict)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=dict)`
   |
18 | def func():
   -     defaultdict(default_factory=dict)  # RUF026
19 +     defaultdict(dict)  # RUF026
20 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:23:5
   |
22 | def func():
23 |     defaultdict(default_factory=list)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=list)`
   |
22 | def func():
   -     defaultdict(default_factory=list)  # RUF026
23 +     defaultdict(list)  # RUF026
24 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:27:5
   |
26 | def func():
27 |     defaultdict(default_factory=tuple)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=tuple)`
   |
26 | def func():
   -     defaultdict(default_factory=tuple)  # RUF026
27 +     defaultdict(tuple)  # RUF026
28 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:34:5
   |
32 |         pass
33 |
34 |     defaultdict(default_factory=foo)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=foo)`
   |
33 |
   -     defaultdict(default_factory=foo)  # RUF026
34 +     defaultdict(foo)  # RUF026
35 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:38:5
   |
37 | def func():
38 |     defaultdict(default_factory=lambda: 1)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=lambda: 1)`
   |
37 | def func():
   -     defaultdict(default_factory=lambda: 1)  # RUF026
38 +     defaultdict(lambda: 1)  # RUF026
39 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:44:5
   |
42 |     from collections import deque
43 |
44 |     defaultdict(default_factory=deque)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=deque)`
   |
43 |
   -     defaultdict(default_factory=deque)  # RUF026
44 +     defaultdict(deque)  # RUF026
45 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:52:5
   |
50 |             pass
51 |
52 |     defaultdict(default_factory=MyCallable())  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=MyCallable())`
   |
51 |
   -     defaultdict(default_factory=MyCallable())  # RUF026
52 +     defaultdict(MyCallable())  # RUF026
53 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:56:5
   |
55 | def func():
56 |     defaultdict(default_factory=tuple, member=1)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=tuple)`
   |
55 | def func():
   -     defaultdict(default_factory=tuple, member=1)  # RUF026
56 +     defaultdict(tuple, member=1)  # RUF026
57 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:60:5
   |
59 | def func():
60 |     defaultdict(member=1, default_factory=tuple)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=tuple)`
   |
59 | def func():
   -     defaultdict(member=1, default_factory=tuple)  # RUF026
60 +     defaultdict(tuple, member=1)  # RUF026
61 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:64:5
   |
63 | def func():
64 |     defaultdict(member=1, default_factory=tuple,)  # RUF026
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `defaultdict(default_factory=tuple)`
   |
63 | def func():
   -     defaultdict(member=1, default_factory=tuple,)  # RUF026
64 +     defaultdict(tuple, member=1,)  # RUF026
65 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:68:5
   |
67 |   def func():
68 | /     defaultdict(
69 | |         member=1,
70 | |         default_factory=tuple,
71 | |     )  # RUF026
   | |_____^
   |
help: Replace with `defaultdict(default_factory=tuple)`
   |
68 |     defaultdict(
   -         member=1,
   -         default_factory=tuple,
69 +         tuple, member=1,
70 |     )  # RUF026
   |
note: This is an unsafe fix and may change runtime behavior

RUF026 [*] `default_factory` is a positional-only argument to `defaultdict`
  --> RUF026.py:75:5
   |
74 |   def func():
75 | /     defaultdict(
76 | |         default_factory=tuple,
77 | |         member=1,
78 | |     )  # RUF026
   | |_____^
   |
help: Replace with `defaultdict(default_factory=tuple)`
   |
75 |     defaultdict(
   -         default_factory=tuple,
   -         member=1,
76 +         tuple, member=1,
77 |     )  # RUF026
   |
note: This is an unsafe fix and may change runtime behavior
