Consider this code:
fn foo(a: Option<i32>) -> i32 {
a.unwrap_or({return 0 }) + 5
}
In this case 0 is always returned (regardless of the value of a), which is probably not what the user intended. Because unwrap_or is never called, this should trigger an "unreachable code" or "dead code" warning, but it does not.
Consider this code:
In this case
0is always returned (regardless of the value ofa), which is probably not what the user intended. Becauseunwrap_oris never called, this should trigger an "unreachable code" or "dead code" warning, but it does not.