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

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

RET507 [*] Unnecessary `else` after `continue` statement
  --> RET507.py:36:9
   |
34 |         if i < y:  # [no-else-continue]
35 |             continue
36 |         else:
   |         ^^^^
37 |             a = z
   |
help: Remove unnecessary `else`
   |
35 |             continue
   -         else:
   -             a = z
36 +         a = z
37 |
   |

RET507 [*] Unnecessary `else` after `continue` statement
  --> RET507.py:47:13
   |
45 |                 b = 2
46 |                 continue
47 |             else:
   |             ^^^^
48 |                 c = 3
49 |                 continue
   |
help: Remove unnecessary `else`
   |
46 |                 continue
   -             else:
   -                 c = 3
   -                 continue
47 +             c = 3
48 +             continue
49 |         else:
   |

RET507 [*] Unnecessary `else` after `continue` statement
  --> RET507.py:63:9
   |
61 |                 b = 2
62 |             continue
63 |         else:
   |         ^^^^
64 |             c = 3
65 |         continue
   |
help: Remove unnecessary `else`
   |
62 |             continue
   -         else:
   -             c = 3
63 +         c = 3
64 |         continue
   |

RET507 [*] Unnecessary `else` after `continue` statement
  --> RET507.py:74:13
   |
72 |                 a = 4
73 |                 continue
74 |             else:
   |             ^^^^
75 |                 b = 2
76 |         else:
   |
help: Remove unnecessary `else`
   |
73 |                 continue
   -             else:
   -                 b = 2
74 +             b = 2
75 |         else:
   |

RET507 [*] Unnecessary `else` after `continue` statement
  --> RET507.py:85:9
   |
83 |         if x:  # [no-else-continue]
84 |             continue
85 |         else:
   |         ^^^^
86 |             try:
87 |                 return
   |
help: Remove unnecessary `else`
   |
84 |             continue
   -         else:
   -             try:
   -                 return
   -             except ValueError:
   -                 continue
85 +         try:
86 +             return
87 +         except ValueError:
88 +             continue
89 |
   |
