diff options
| author | Tim Nielens <tim.nielens@gmail.com> | 2020-10-13 10:24:00 +0200 |
|---|---|---|
| committer | Tim Nielens <tim.nielens@gmail.com> | 2020-10-14 22:16:48 +0200 |
| commit | a8fb69f065a427f5d3fc7222b834cad9a2a7a712 (patch) | |
| tree | baa78d3d31a580759f8e62df41b0aa7899bc882f | |
| parent | fc846c37fcc720c4a5c2e2075102c1957433e703 (diff) | |
| download | rust-a8fb69f065a427f5d3fc7222b834cad9a2a7a712.tar.gz rust-a8fb69f065a427f5d3fc7222b834cad9a2a7a712.zip | |
manual-unwrap-or / more pr remarks
| -rw-r--r-- | clippy_lints/src/manual_unwrap_or.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/clippy_lints/src/manual_unwrap_or.rs b/clippy_lints/src/manual_unwrap_or.rs index ced941fac1a..719a8b91f66 100644 --- a/clippy_lints/src/manual_unwrap_or.rs +++ b/clippy_lints/src/manual_unwrap_or.rs @@ -47,7 +47,7 @@ impl LateLintPass<'_> for ManualUnwrapOr { } } -fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> bool { +fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { fn applicable_none_arm<'a>(arms: &'a [Arm<'a>]) -> Option<&'a Arm<'a>> { if_chain! { if arms.len() == 2; @@ -69,8 +69,7 @@ fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tc if !utils::usage::contains_return_break_continue_macro(none_arm.body); then { Some(none_arm) - } - else { + } else { None } } @@ -102,14 +101,11 @@ fn lint_option_unwrap_or_case<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tc "{}.{}({}{})", scrutinee_snippet, method, - if eager_eval { ""} else { "|| " }, + if eager_eval { "" } else { "|| " }, reindented_none_body ), Applicability::MachineApplicable, ); - true - } else { - false } } } |
