Unwraps

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.85.135