Say I have function that maybe returns None and I check the result:
deff() ->int|None: ...
iff() isNone: ...
I rewrite the function so that it never returns None:
deff() ->int: ...
iff() isNone: ...
Now the is None check makes no sense -- it will always fail. This is a mistake introduced in refactoring and it should be flagged. (And similar for is not None checks)
In Rust I don't think this kind of error is possible:
fnf() -> Option<u8>;iff().is_none(){}// okayfng() -> u8;ifg().is_none(){}// no good
Say I have function that maybe returns
Noneand I check the result:I rewrite the function so that it never returns
None:Now the
is Nonecheck makes no sense -- it will always fail. This is a mistake introduced in refactoring and it should be flagged. (And similar foris not Nonechecks)In Rust I don't think this kind of error is possible: