3 ms·
>An application error (returned null) shouldn't abort your application with a hard error, no logs. Its just plain poor practice to use unwrap(). What? That's w
by MichaelGG 9y ago
>An application error (returned null) shouldn't abort your application with a hard error, no logs. Its just plain poor practice to use unwrap().
What? That's what every other language does.
file.open("foo").read_line()
If open fails it'll either throw or return null which will then cause read_line to throw a null pointer exception. Rust just makes things explicit here.
Though it might be interesting if there was a special opt-in Deref impl for Result and Option so people could omit the unwrap and just get it implicitly, for the occasions when you don't want that explicitness.