Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a8fb69f

Browse files
committed
manual-unwrap-or / more pr remarks
1 parent fc846c3 commit a8fb69f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

clippy_lints/src/manual_unwrap_or.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl LateLintPass<'_> for ManualUnwrapOr {
4747
}
4848
}
4949

50-
fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> bool {
50+
fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
5151
fn applicable_none_arm<'a>(arms: &'a [Arm<'a>]) -> Option<&'a Arm<'a>> {
5252
if_chain! {
5353
if arms.len() == 2;
@@ -69,8 +69,7 @@ fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tc
6969
if !utils::usage::contains_return_break_continue_macro(none_arm.body);
7070
then {
7171
Some(none_arm)
72-
}
73-
else {
72+
} else {
7473
None
7574
}
7675
}
@@ -102,14 +101,11 @@ fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tc
102101
"{}.{}({}{})",
103102
scrutinee_snippet,
104103
method,
105-
if eager_eval { ""} else { "|| " },
104+
if eager_eval { "" } else { "|| " },
106105
reindented_none_body
107106
),
108107
Applicability::MachineApplicable,
109108
);
110-
true
111-
} else {
112-
false
113109
}
114110
}
115111
}

0 commit comments

Comments
 (0)