---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B012.py:5:9: B012 `return` inside `finally` blocks cause exceptions to be silenced
  |
3 |         pass
4 |     finally:
5 |         return  # warning
  |         ^^^^^^ B012
  |

B012.py:13:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
11 |     finally:
12 |         if 1 + 0 == 2 - 1:
13 |             return  # warning
   |             ^^^^^^ B012
   |

B012.py:21:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
19 |     finally:
20 |         try:
21 |             return  # warning
   |             ^^^^^^ B012
22 |         except Exception:
23 |             pass
   |

B012.py:31:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
29 |             pass
30 |         finally:
31 |             return  # warning
   |             ^^^^^^ B012
32 |     finally:
33 |         pass
   |

B012.py:44:21: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
42 |                     pass
43 |                 finally:
44 |                     return  # warning
   |                     ^^^^^^ B012
45 | 
46 |         finally:
   |

B012.py:66:13: B012 `break` inside `finally` blocks cause exceptions to be silenced
   |
64 |             pass
65 |         finally:
66 |             break  # warning
   |             ^^^^^ B012
67 | 
68 |             def j():
   |

B012.py:78:13: B012 `continue` inside `finally` blocks cause exceptions to be silenced
   |
76 |             pass
77 |         finally:
78 |             continue  # warning
   |             ^^^^^^^^ B012
79 | 
80 |             def j():
   |

B012.py:94:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
92 |             continue  # no warning
93 |         while True:
94 |             return  # warning
   |             ^^^^^^ B012
   |

B012.py:101:9: B012 `continue` inside `finally` blocks cause exceptions to be silenced
    |
 99 |         pass
100 |     finally:
101 |         continue  # warning
    |         ^^^^^^^^ B012
102 | 
103 | while True:
    |

B012.py:107:9: B012 `break` inside `finally` blocks cause exceptions to be silenced
    |
105 |         pass
106 |     finally:
107 |         break  # warning
    |         ^^^^^ B012
    |

B012.py:118:17: B012 `break` inside `finally` blocks cause exceptions to be silenced
    |
116 |                 y = 0
117 |             case 0, *x:
118 |                 break  # warning
    |                 ^^^^^ B012
    |


