Apply needless_return suggestions

This commit is contained in:
dswij 2022-06-02 20:17:00 +08:00
parent b885035ef7
commit 678dcdd2be

View file

@ -97,7 +97,7 @@ pub(super) fn check<'tcx>(
let func_snippet = snippet(cx, map_arg.span, ".."); let func_snippet = snippet(cx, map_arg.span, "..");
let msg = "called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling \ let msg = "called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling \
`and_then(..)` instead"; `and_then(..)` instead";
return span_lint_and_sugg( span_lint_and_sugg(
cx, cx,
OPTION_MAP_OR_NONE, OPTION_MAP_OR_NONE,
expr.span, expr.span,
@ -110,7 +110,7 @@ pub(super) fn check<'tcx>(
let msg = "called `map_or(None, Some)` on a `Result` value. This can be done more directly by calling \ let msg = "called `map_or(None, Some)` on a `Result` value. This can be done more directly by calling \
`ok()` instead"; `ok()` instead";
let self_snippet = snippet(cx, recv.span, ".."); let self_snippet = snippet(cx, recv.span, "..");
return span_lint_and_sugg( span_lint_and_sugg(
cx, cx,
RESULT_MAP_OR_INTO_OPTION, RESULT_MAP_OR_INTO_OPTION,
expr.span, expr.span,