March 2018
Intermediate to advanced
272 pages
7h 4m
English
Rust allows you to unwrap Results and Options, at the cost of panicking if they are Err(_) or None respectively. This should be avoided in any production code, and either use expect() to add an information message or use error chaining with the ? operator, for example. You can also match them and control the error.
To avoid those unnecessary panics, you can use the result_unwrap_used, option_unwrap_used, option_map_unwrap_or_else, option_map_unwrap_or, and result_map_unwrap_or_else lints.
Read now
Unlock full access