Skip to content

Commit 3ab6ef1

Browse files
committed
Remove from_bool closure.
The code is clearer and simpler without it. Note that the `a == b` early return at the top of the function means the `a == b` test at the end of the function could never succeed.
1 parent fab85dd commit 3ab6ef1

File tree

1 file changed

+2
-4
lines changed
  • compiler/rustc_mir_build/src/thir/pattern

1 file changed

+2
-4
lines changed

compiler/rustc_mir_build/src/thir/pattern/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,8 @@ pub(crate) fn compare_const_vals<'tcx>(
757757
assert_eq!(a.ty(), b.ty());
758758
assert_eq!(a.ty(), ty);
759759

760-
let from_bool = |v: bool| v.then_some(Ordering::Equal);
761-
762760
if a == b {
763-
return from_bool(true);
761+
return Some(Ordering::Equal);
764762
}
765763

766764
let a_bits = a.try_eval_bits(tcx, param_env, ty);
@@ -790,5 +788,5 @@ pub(crate) fn compare_const_vals<'tcx>(
790788
};
791789
}
792790

793-
from_bool(a == b)
791+
None
794792
}

0 commit comments

Comments
 (0)