---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF037 [*] Unnecessary empty iterable within a deque call
 --> RUF037.py:6:13
  |
5 | def f():
6 |     queue = collections.deque([])  # RUF037
  |             ^^^^^^^^^^^^^^^^^^^^^
  |
help: Replace with `deque()`
  |
5 | def f():
  -     queue = collections.deque([])  # RUF037
6 +     queue = collections.deque()  # RUF037
7 |
  |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:10:13
   |
 9 | def f():
10 |     queue = collections.deque([], maxlen=10)  # RUF037
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `deque(maxlen=...)`
   |
9  | def f():
   -     queue = collections.deque([], maxlen=10)  # RUF037
10 +     queue = collections.deque(maxlen=10)  # RUF037
11 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:14:13
   |
13 | def f():
14 |     queue = deque([])  # RUF037
   |             ^^^^^^^^^
   |
help: Replace with `deque()`
   |
13 | def f():
   -     queue = deque([])  # RUF037
14 +     queue = deque()  # RUF037
15 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:18:13
   |
17 | def f():
18 |     queue = deque(())  # RUF037
   |             ^^^^^^^^^
   |
help: Replace with `deque()`
   |
17 | def f():
   -     queue = deque(())  # RUF037
18 +     queue = deque()  # RUF037
19 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:22:13
   |
21 | def f():
22 |     queue = deque({})  # RUF037
   |             ^^^^^^^^^
   |
help: Replace with `deque()`
   |
21 | def f():
   -     queue = deque({})  # RUF037
22 +     queue = deque()  # RUF037
23 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:26:13
   |
25 | def f():
26 |     queue = deque(set())  # RUF037
   |             ^^^^^^^^^^^^
   |
help: Replace with `deque()`
   |
25 | def f():
   -     queue = deque(set())  # RUF037
26 +     queue = deque()  # RUF037
27 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:30:13
   |
29 | def f():
30 |     queue = collections.deque([], maxlen=10)  # RUF037
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `deque(maxlen=...)`
   |
29 | def f():
   -     queue = collections.deque([], maxlen=10)  # RUF037
30 +     queue = collections.deque(maxlen=10)  # RUF037
31 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:61:13
   |
60 | def f():
61 |     x = 0 or(deque)([])
   |             ^^^^^^^^^^^
   |
help: Replace with `deque()`
   |
60 | def f():
   -     x = 0 or(deque)([])
61 +     x = 0 or(deque)()
62 |
   |

RUF037 Unnecessary empty iterable within a deque call
  --> RUF037.py:66:5
   |
64 | # regression tests for https://github.com/astral-sh/ruff/issues/18612
65 | def f():
66 |     deque([], *[10])  # RUF037 but no fix
   |     ^^^^^^^^^^^^^^^^
67 |     deque([], **{"maxlen": 10})  # RUF037
68 |     deque([], foo=1)  # RUF037
   |
help: Replace with `deque()`

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:67:5
   |
65 | def f():
66 |     deque([], *[10])  # RUF037 but no fix
67 |     deque([], **{"maxlen": 10})  # RUF037
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
68 |     deque([], foo=1)  # RUF037
   |
help: Replace with `deque()`
   |
66 |     deque([], *[10])  # RUF037 but no fix
   -     deque([], **{"maxlen": 10})  # RUF037
67 +     deque(**{"maxlen": 10})  # RUF037
68 |     deque([], foo=1)  # RUF037
   |
note: This is an unsafe fix and may change runtime behavior

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:68:5
   |
66 |     deque([], *[10])  # RUF037 but no fix
67 |     deque([], **{"maxlen": 10})  # RUF037
68 |     deque([], foo=1)  # RUF037
   |     ^^^^^^^^^^^^^^^^
   |
help: Replace with `deque()`
   |
67 |     deque([], **{"maxlen": 10})  # RUF037
   -     deque([], foo=1)  # RUF037
68 +     deque(foo=1)  # RUF037
69 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:80:5
   |
78 |   # are deleted
79 |   def f():
80 | /     deque(  # a comment in deque, deleted
81 | |         [  # a comment _in_ the list, deleted
82 | |         ],  # a comment after the list, deleted
83 | |         maxlen=10,  # a comment on maxlen, deleted
84 | |         )  # only this is preserved
   | |_________^
   |
help: Replace with `deque(maxlen=...)`
   |
79 | def f():
   -     deque(  # a comment in deque, deleted
   -         [  # a comment _in_ the list, deleted
   -         ],  # a comment after the list, deleted
   -         maxlen=10,  # a comment on maxlen, deleted
   -         )  # only this is preserved
80 +     deque(maxlen=10)  # only this is preserved
81 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:89:5
   |
87 | # `maxlen` can also be passed positionally
88 | def f():
89 |     deque([], 10)
   |     ^^^^^^^^^^^^^
   |
help: Replace with `deque(maxlen=...)`
   |
88 | def f():
   -     deque([], 10)
89 +     deque(maxlen=10)
90 |
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:93:5
   |
92 | def f():
93 |     deque([], iterable=[])
   |     ^^^^^^^^^^^^^^^^^^^^^^
94 |
95 | # https://github.com/astral-sh/ruff/issues/18854
   |
help: Replace with `deque()`
   |
92 | def f():
   -     deque([], iterable=[])
93 +     deque([])
94 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:96:1
   |
95 | # https://github.com/astral-sh/ruff/issues/18854
96 | deque("")
   | ^^^^^^^^^
97 | deque(b"")
98 | deque(f"")
   |
help: Replace with `deque()`
   |
95 | # https://github.com/astral-sh/ruff/issues/18854
   - deque("")
96 + deque()
97 | deque(b"")
   |

RUF037 [*] Unnecessary empty iterable within a deque call
  --> RUF037.py:97:1
   |
95 | # https://github.com/astral-sh/ruff/issues/18854
96 | deque("")
97 | deque(b"")
   | ^^^^^^^^^^
98 | deque(f"")
99 | deque(f"" "")
   |
help: Replace with `deque()`
   |
96 | deque("")
   - deque(b"")
97 + deque()
98 | deque(f"")
   |

RUF037 [*] Unnecessary empty iterable within a deque call
   --> RUF037.py:98:1
    |
 96 | deque("")
 97 | deque(b"")
 98 | deque(f"")
    | ^^^^^^^^^^
 99 | deque(f"" "")
100 | deque(f"" f"")
    |
help: Replace with `deque()`
   |
97 | deque(b"")
   - deque(f"")
98 + deque()
99 | deque(f"" "")
   |

RUF037 [*] Unnecessary empty iterable within a deque call
   --> RUF037.py:99:1
    |
 97 | deque(b"")
 98 | deque(f"")
 99 | deque(f"" "")
    | ^^^^^^^^^^^^^
100 | deque(f"" f"")
101 | deque("abc") # OK
    |
help: Replace with `deque()`
    |
98  | deque(f"")
    - deque(f"" "")
99  + deque()
100 | deque(f"" f"")
    |

RUF037 [*] Unnecessary empty iterable within a deque call
   --> RUF037.py:100:1
    |
 98 | deque(f"")
 99 | deque(f"" "")
100 | deque(f"" f"")
    | ^^^^^^^^^^^^^^
101 | deque("abc") # OK
102 | deque(b"abc") # OK
    |
help: Replace with `deque()`
    |
99  | deque(f"" "")
    - deque(f"" f"")
100 + deque()
101 | deque("abc") # OK
    |

RUF037 [*] Unnecessary empty iterable within a deque call
   --> RUF037.py:107:1
    |
106 | # https://github.com/astral-sh/ruff/issues/19951
107 | deque(t"")
    | ^^^^^^^^^^
108 | deque(t""  t"")
109 | deque(t"{""}") # OK
    |
help: Replace with `deque()`
    |
106 | # https://github.com/astral-sh/ruff/issues/19951
    - deque(t"")
107 + deque()
108 | deque(t""  t"")
    |

RUF037 [*] Unnecessary empty iterable within a deque call
   --> RUF037.py:108:1
    |
106 | # https://github.com/astral-sh/ruff/issues/19951
107 | deque(t"")
108 | deque(t""  t"")
    | ^^^^^^^^^^^^^^^
109 | deque(t"{""}") # OK
    |
help: Replace with `deque()`
    |
107 | deque(t"")
    - deque(t""  t"")
108 + deque()
109 | deque(t"{""}") # OK
    |

RUF037 [*] Unnecessary empty iterable within a deque call
   --> RUF037.py:112:1
    |
111 | # https://github.com/astral-sh/ruff/issues/20050
112 | deque(f"{""}")  # RUF037
    | ^^^^^^^^^^^^^^
113 |
114 | deque(f"{b""}")
    |
help: Replace with `deque()`
    |
111 | # https://github.com/astral-sh/ruff/issues/20050
    - deque(f"{""}")  # RUF037
112 + deque()  # RUF037
113 |
    |
