---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
---
RET506 [*] Unnecessary `elif` after `raise` statement
  --> RET506.py:8:5
   |
 6 |         a = 1
 7 |         raise Exception(y)
 8 |     elif z:
   |     ^^^^
 9 |         b = 2
10 |         raise Exception(w)
   |
help: Remove unnecessary `elif`
  |
7 |         raise Exception(y)
  -     elif z:
8 +     if z:
9 |         b = 2
  |

RET506 [*] Unnecessary `elif` after `raise` statement
  --> RET506.py:23:5
   |
21 |             b = 2
22 |         raise Exception(x)
23 |     elif z:
   |     ^^^^
24 |         raise Exception(y)
25 |     else:
   |
help: Remove unnecessary `elif`
   |
22 |         raise Exception(x)
   -     elif z:
23 +     if z:
24 |         raise Exception(y)
   |

RET506 [*] Unnecessary `else` after `raise` statement
  --> RET506.py:34:5
   |
32 |         a = 1
33 |         raise Exception(y)
34 |     else:
   |     ^^^^
35 |         b = 2
36 |         raise Exception(z)
   |
help: Remove unnecessary `else`
   |
33 |         raise Exception(y)
   -     else:
   -         b = 2
   -         raise Exception(z)
34 +     b = 2
35 +     raise Exception(z)
36 |
   |

RET506 [*] Unnecessary `else` after `raise` statement
  --> RET506.py:45:9
   |
43 |             b = 2
44 |             raise Exception(y)
45 |         else:
   |         ^^^^
46 |             c = 3
47 |             raise Exception(x)
   |
help: Remove unnecessary `else`
   |
44 |             raise Exception(y)
   -         else:
   -             c = 3
   -             raise Exception(x)
45 +         c = 3
46 +         raise Exception(x)
47 |     else:
   |

RET506 [*] Unnecessary `else` after `raise` statement
  --> RET506.py:60:5
   |
58 |             b = 2
59 |         raise Exception(x)
60 |     else:
   |     ^^^^
61 |         c = 3
62 |     raise Exception(y)
   |
help: Remove unnecessary `else`
   |
59 |         raise Exception(x)
   -     else:
   -         c = 3
60 +     c = 3
61 |     raise Exception(y)
   |

RET506 [*] Unnecessary `else` after `raise` statement
  --> RET506.py:70:9
   |
68 |             a = 4
69 |             raise Exception(x)
70 |         else:
   |         ^^^^
71 |             b = 2
72 |     else:
   |
help: Remove unnecessary `else`
   |
69 |             raise Exception(x)
   -         else:
   -             b = 2
70 +         b = 2
71 |     else:
   |

RET506 [*] Unnecessary `else` after `raise` statement
  --> RET506.py:80:5
   |
78 |     if x:  # [no-else-raise]
79 |         raise Exception(True)
80 |     else:
   |     ^^^^
81 |         try:
82 |             raise Exception(False)
   |
help: Remove unnecessary `else`
   |
79 |         raise Exception(True)
   -     else:
   -         try:
   -             raise Exception(False)
   -         except ValueError:
   -             raise Exception(None)
80 +     try:
81 +         raise Exception(False)
82 +     except ValueError:
83 +         raise Exception(None)
84 |
   |
