---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
---
RET501 [*] Do not explicitly `return None` in function if it is the only possible return value
 --> RET501.py:4:5
  |
2 |     if not y:
3 |         return
4 |     return None  # error
  |     ^^^^^^^^^^^
  |
help: Remove explicit `return None`
  |
3 |         return
  -     return None  # error
4 +     return  # error
5 |
  |

RET501 [*] Do not explicitly `return None` in function if it is the only possible return value
  --> RET501.py:14:9
   |
12 |     def get(self, key: str) -> None:
13 |         print(f"{key} not found")
14 |         return None
   |         ^^^^^^^^^^^
15 |
16 |     @property
   |
help: Remove explicit `return None`
   |
13 |         print(f"{key} not found")
   -         return None
14 +         return
15 |
   |

RET501 [*] Do not explicitly `return None` in function if it is the only possible return value
  --> RET501.py:59:9
   |
57 |           if not bar:
58 |               return
59 | /         return (
60 | |             None # comment
61 | |         )
   | |_________^
   |
help: Remove explicit `return None`
   |
58 |             return
   -         return (
   -             None # comment
   -         )
59 +         return
   |
note: This is an unsafe fix and may change runtime behavior
