basedmypy
basedmypy copied to clipboard
`redundant-expr` is annoying when using `assert_never`
from __future__ import annotations
from typing import Literal, assert_never
foo: 1 | 2
if foo == 1:
...
elif foo == 2: # error: redundant-expr
...
else:
assert_never(foo)
a possible solution is to just not report redundant-expr errors if there's an else statement, because you would otherwise get an unreachable error anyway if you aren't using assert_never