Hacker News new | ask | show | jobs
by HippoBaro 975 days ago
There's absolutely nothing in Rust that mandate error handling. You can always ignore them, just like in any other language.
2 comments

It'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.
Rust'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.