diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index faf48ae570fdd..334a2569503f0 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1406,6 +1406,20 @@ mod impls { _ => unsafe { unreachable_unchecked() }, } } + + #[inline] + fn min(self, other: bool) -> bool { + // The default implementation is not optimized well, + // see . + self & other + } + + #[inline] + fn max(self, other: bool) -> bool { + // The default implementation is not optimized well, + // see . + self | other + } } ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }