---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
---
RET508 [*] Unnecessary `elif` after `break` statement
  --> RET508.py:8:9
   |
 6 |         if i > y:  # [no-else-break]
 7 |             break
 8 |         elif i > w:
   |         ^^^^
 9 |             break
10 |         else:
   |
help: Remove unnecessary `elif`
  |
7 |             break
  -         elif i > w:
8 +         if i > w:
9 |             break
  |

RET508 [*] Unnecessary `elif` after `break` statement
  --> RET508.py:22:9
   |
20 |                 b = 2
21 |             break
22 |         elif z:
   |         ^^^^
23 |             c = 2
24 |         else:
   |
help: Remove unnecessary `elif`
   |
21 |             break
   -         elif z:
22 +         if z:
23 |             c = 2
   |

RET508 [*] Unnecessary `else` after `break` statement
  --> RET508.py:33:9
   |
31 |         if i > y:  # [no-else-break]
32 |             break
33 |         else:
   |         ^^^^
34 |             a = z
   |
help: Remove unnecessary `else`
   |
32 |             break
   -         else:
   -             a = z
33 +         a = z
34 |
   |

RET508 [*] Unnecessary `else` after `break` statement
  --> RET508.py:44:13
   |
42 |                 b = 2
43 |                 break
44 |             else:
   |             ^^^^
45 |                 c = 3
46 |                 break
   |
help: Remove unnecessary `else`
   |
43 |                 break
   -             else:
   -                 c = 3
   -                 break
44 +             c = 3
45 +             break
46 |         else:
   |

RET508 [*] Unnecessary `else` after `break` statement
  --> RET508.py:60:9
   |
58 |                 b = 2
59 |             break
60 |         else:
   |         ^^^^
61 |             c = 3
62 |         break
   |
help: Remove unnecessary `else`
   |
59 |             break
   -         else:
   -             c = 3
60 +         c = 3
61 |         break
   |

RET508 [*] Unnecessary `else` after `break` statement
  --> RET508.py:71:13
   |
69 |                 a = 4
70 |                 break
71 |             else:
   |             ^^^^
72 |                 b = 2
73 |         else:
   |
help: Remove unnecessary `else`
   |
70 |                 break
   -             else:
   -                 b = 2
71 +             b = 2
72 |         else:
   |

RET508 [*] Unnecessary `else` after `break` statement
  --> RET508.py:82:9
   |
80 |         if x:  # [no-else-break]
81 |             break
82 |         else:
   |         ^^^^
83 |             try:
84 |                 return
   |
help: Remove unnecessary `else`
   |
81 |             break
   -         else:
   -             try:
   -                 return
   -             except ValueError:
   -                 break
82 +         try:
83 +             return
84 +         except ValueError:
85 +             break
86 |
   |

RET508 [*] Unnecessary `else` after `break` statement
   --> RET508.py:158:13
    |
156 |             if i > w:
157 |                 break
158 |             else:
    |             ^^^^
159 |                 a = z
    |
help: Remove unnecessary `else`
    |
157 |                 break
    -             else:
    -                 a = z
158 +             a = z
    |
