Skip to content

Commit 4b55083

Browse files
committed
Remove None return values from check_return_stmt
1 parent 5868c33 commit 4b55083

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy/checker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,13 +1500,13 @@ def check_return_stmt(self, s: ReturnStmt) -> None:
15001500
typ = self.accept(s.expr, return_type)
15011501
# Returning a value of type Any is always fine.
15021502
if isinstance(typ, AnyType):
1503-
return None
1503+
return
15041504

15051505
if self.is_unusable_type(return_type):
15061506
# Lambdas are allowed to have a unusable returns.
15071507
# Functions returning a value of type None are allowed to have a Void return.
15081508
if isinstance(self.function_stack[-1], FuncExpr) or isinstance(typ, NoneTyp):
1509-
return None
1509+
return
15101510
self.fail(messages.NO_RETURN_VALUE_EXPECTED, s)
15111511
else:
15121512
self.check_subtype(
@@ -1519,10 +1519,10 @@ def check_return_stmt(self, s: ReturnStmt) -> None:
15191519
else:
15201520
# Empty returns are valid in Generators with Any typed returns.
15211521
if (self.function_stack[-1].is_generator and isinstance(return_type, AnyType)):
1522-
return None
1522+
return
15231523

15241524
if isinstance(return_type, (Void, NoneTyp, AnyType)):
1525-
return None
1525+
return
15261526

15271527
if self.in_checked_function():
15281528
self.fail(messages.RETURN_VALUE_EXPECTED, s)

0 commit comments

Comments
 (0)