In the case of the lambda version, the compiler will fail if you forget a break statement or don't handle a possible case. Plus this way you can make x const, which can also prevent breaking other code further down.
It seems to me the extra safety it provides actually makes it harder for a novice to break your code?
Unless you mean strictly in the sense of "harder to break compilation", but I'm not sure that's a good thing (insert obligatory mention of Rust here)
It seems to me the extra safety it provides actually makes it harder for a novice to break your code?
Unless you mean strictly in the sense of "harder to break compilation", but I'm not sure that's a good thing (insert obligatory mention of Rust here)