You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
ifletErr(err) = do_something_fallible(){// log the error}
The text was updated successfully, but these errors were encountered:
Lint explanation
Detect code that uses
let _ = result.map_err();
pattern instead ofif-let
. The reasoning is thatmap_err
is meant for changing theerror
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
Good
The text was updated successfully, but these errors were encountered: