cx: &LateContext<'tcx>,
arms: &[Arm<'tcx>],
) -> Option<(&'tcx Pat<'tcx>, &'tcx Expr<'tcx>, &'tcx Expr<'tcx>)> {
- if arms.len() == 2 {
- return if is_none_or_err_arm(cx, &arms[1]) {
- Some((arms[0].pat, arms[0].body, arms[1].body))
- } else if is_none_or_err_arm(cx, &arms[0]) {
- Some((arms[1].pat, arms[1].body, arms[0].body))
+ if let [first_arm, second_arm] = arms
+ && first_arm.guard.is_none()
+ && second_arm.guard.is_none()
+ {
+ return if is_none_or_err_arm(cx, second_arm) {
+ Some((first_arm.pat, first_arm.body, second_arm.body))
+ } else if is_none_or_err_arm(cx, first_arm) {
+ Some((second_arm.pat, second_arm.body, first_arm.body))
} else {
None
};