Skip to content

Commit

Permalink
Fix false positive in FURB126:
Browse files Browse the repository at this point in the history
Closes #336.
  • Loading branch information
dosisod committed Nov 21, 2024
1 parent 4fee0cc commit dd80a28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion refurb/checks/flow/simplify_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_trailing_return(node: Statement) -> Statement | None:

case MatchStmt(
bodies=[*bodies, Block(body=[stmt])],
patterns=[*_, AsPattern(pattern=None)],
patterns=[*_, AsPattern(pattern=None, name=None)],
) if all(isinstance(block.body[-1], ReturnStmt) for block in bodies):
return get_trailing_return(stmt)

Expand Down
6 changes: 6 additions & 0 deletions test/data/err_126.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ def func8(x):

else:
return 1


def func9(x):
match x:
case y:
return y

0 comments on commit dd80a28

Please sign in to comment.