Lint explanation
Detect code that uses let _ = result.map_err(); pattern instead of if-let. The reasoning is that map_err is meant for changing the error type of the result, so it does more than just inspecting the error result. if-let intentionally ignores any values that don't match the pattern and is subjectively clearer, and objectively shorter.
Example code
Bad
let _ = do_something_fallible().map_err(|err| {
// log the error
});
Good
if let Err(err) = do_something_fallible() {
// log the error
}
Lint explanation
Detect code that uses
let _ = result.map_err();pattern instead ofif-let. The reasoning is thatmap_erris meant for changing theerrortype of the result, so it does more than just inspecting the error result.if-letintentionally ignores any values that don't match the pattern and is subjectively clearer, and objectively shorter.Example code
Bad
Good