---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
 --> SIM110.py:3:5
  |
1 |   def f():
2 |       # SIM110
3 | /     for x in iterable:
4 | |         if check(x):
5 | |             return True
6 | |     return False
  | |________________^
  |
help: Replace with `return any(check(x) for x in iterable)`
  |
2 |     # SIM110
  -     for x in iterable:
  -         if check(x):
  -             return True
  -     return False
3 +     return any(check(x) for x in iterable)
4 |
  |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
  --> SIM110.py:25:5
   |
23 |   def f():
24 |       # SIM111
25 | /     for x in iterable:
26 | |         if check(x):
27 | |             return False
28 | |     return True
   | |_______________^
   |
help: Replace with `return all(not check(x) for x in iterable)`
   |
24 |     # SIM111
   -     for x in iterable:
   -         if check(x):
   -             return False
   -     return True
25 +     return all(not check(x) for x in iterable)
26 |
   |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop
  --> SIM110.py:33:5
   |
31 |   def f():
32 |       # SIM111
33 | /     for x in iterable:
34 | |         if not x.is_empty():
35 | |             return False
36 | |     return True
   | |_______________^
   |
help: Replace with `return all(x.is_empty() for x in iterable)`
   |
32 |     # SIM111
   -     for x in iterable:
   -         if not x.is_empty():
   -             return False
   -     return True
33 +     return all(x.is_empty() for x in iterable)
34 |
   |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
  --> SIM110.py:55:5
   |
53 |   def f():
54 |       # SIM110
55 | /     for x in iterable:
56 | |         if check(x):
57 | |             return True
58 | |     else:
59 | |         return False
   | |____________________^
   |
help: Replace with `return any(check(x) for x in iterable)`
   |
54 |     # SIM110
   -     for x in iterable:
   -         if check(x):
   -             return True
   -     else:
   -         return False
55 +     return any(check(x) for x in iterable)
56 |
   |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
  --> SIM110.py:64:5
   |
62 |   def f():
63 |       # SIM111
64 | /     for x in iterable:
65 | |         if check(x):
66 | |             return False
67 | |     else:
68 | |         return True
   | |___________________^
   |
help: Replace with `return all(not check(x) for x in iterable)`
   |
63 |     # SIM111
   -     for x in iterable:
   -         if check(x):
   -             return False
   -     else:
   -         return True
64 +     return all(not check(x) for x in iterable)
65 |
   |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
  --> SIM110.py:73:5
   |
71 |   def f():
72 |       # SIM110
73 | /     for x in iterable:
74 | |         if check(x):
75 | |             return True
76 | |     else:
77 | |         return False
   | |____________________^
78 |       return True
   |
help: Replace with `return any(check(x) for x in iterable)`
   |
72 |     # SIM110
   -     for x in iterable:
   -         if check(x):
   -             return True
   -     else:
   -         return False
73 +     return any(check(x) for x in iterable)
74 |     return True
   |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
  --> SIM110.py:83:5
   |
81 |   def f():
82 |       # SIM111
83 | /     for x in iterable:
84 | |         if check(x):
85 | |             return False
86 | |     else:
87 | |         return True
   | |___________________^
88 |       return False
   |
help: Replace with `return all(not check(x) for x in iterable)`
   |
82 |     # SIM111
   -     for x in iterable:
   -         if check(x):
   -             return False
   -     else:
   -         return True
83 +     return all(not check(x) for x in iterable)
84 |     return False
   |
note: This is an unsafe fix and may change runtime behavior

SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop
   --> SIM110.py:124:5
    |
122 |           pass
123 |
124 | /     for x in iterable:
125 | |         if check(x):
126 | |             return True
127 | |     return False
    | |________________^
    |
help: Replace with `return any(check(x) for x in iterable)`

SIM110 Use `return all(not check(x) for x in iterable)` instead of `for` loop
   --> SIM110.py:134:5
    |
132 |           pass
133 |
134 | /     for x in iterable:
135 | |         if check(x):
136 | |             return False
137 | |     return True
    | |_______________^
    |
help: Replace with `return all(not check(x) for x in iterable)`

SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
   --> SIM110.py:144:5
    |
143 |       # SIM110
144 | /     for x in iterable:
145 | |         if check(x):
146 | |             return True
147 | |     return False
    | |________________^
    |
help: Replace with `return any(check(x) for x in iterable)`
    |
143 |     # SIM110
    -     for x in iterable:
    -         if check(x):
    -             return True
    -     return False
144 +     return any(check(x) for x in iterable)
145 |
    |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
   --> SIM110.py:154:5
    |
153 |       # SIM111
154 | /     for x in iterable:
155 | |         if check(x):
156 | |             return False
157 | |     return True
    | |_______________^
    |
help: Replace with `return all(not check(x) for x in iterable)`
    |
153 |     # SIM111
    -     for x in iterable:
    -         if check(x):
    -             return False
    -     return True
154 +     return all(not check(x) for x in iterable)
155 |
    |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop
   --> SIM110.py:162:5
    |
160 |   def f():
161 |       # SIM110
162 | /     for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ":
163 | |         if x.isdigit():
164 | |             return True
165 | |     return False
    | |________________^
    |
help: Replace with `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")`
    |
161 |     # SIM110
    -     for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ":
    -         if x.isdigit():
    -             return True
    -     return False
162 +     return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")
163 |
    |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
   --> SIM110.py:184:5
    |
182 |   async def f():
183 |       # SIM110
184 | /     for x in iterable:
185 | |         if check(x):
186 | |             return True
187 | |     return False
    | |________________^
188 |
189 |   async def f():
    |
help: Replace with `return any(check(x) for x in iterable)`
    |
183 |     # SIM110
    -     for x in iterable:
    -         if check(x):
    -             return True
    -     return False
184 +     return any(check(x) for x in iterable)
185 |
    |
note: This is an unsafe fix and may change runtime behavior

SIM110 [*] Use `return any(check(x) for x in await iterable)` instead of `for` loop
   --> SIM110.py:191:5
    |
189 |   async def f():
190 |       # SIM110
191 | /     for x in await iterable:
192 | |         if check(x):
193 | |             return True
194 | |     return False
    | |________________^
195 |
196 |   def f():
    |
help: Replace with `return any(check(x) for x in await iterable)`
    |
190 |     # SIM110
    -     for x in await iterable:
    -         if check(x):
    -             return True
    -     return False
191 +     return any(check(x) for x in await iterable)
192 |
    |
note: This is an unsafe fix and may change runtime behavior
