4 ms·
There's absolutely nothing in Rust that mandate error handling. You can always ignore them, just like in any other language.
by HippoBaro 3y ago
There's absolutely nothing in Rust that mandate error handling. You can always ignore them, just like in any other language.
- josephcsible 3y agoRust's type system mandates it. If you disagree, then post a Rust program that uses the result of a call to std::fs::read_to_string without specifying how to handle an error.
- rollcat 3y agoIt's about how hard it is to make a mistake in well-intentioned code. The number of times my fingers typed "if err != nil" when what I did actually mean was "if err == nil" is too damn high, and the consequences often dire. I usually prefer Go to Rust (and even defend Go's error handling most of the time), but that's the one aspect that Rust handles 1000x better: the common case must be easier, so that you don't get as easily tripped up by the uncommon.