We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 629976b commit 284bf26Copy full SHA for 284bf26
core/src/cmp.rs
@@ -981,7 +981,8 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
981
#[must_use]
982
#[stable(feature = "rust1", since = "1.0.0")]
983
fn le(&self, other: &Rhs) -> bool {
984
- matches!(self.partial_cmp(other), Some(Less | Equal))
+ // Pattern `Some(Less | Eq)` optimizes worse than negating `None | Some(Greater)`.
985
+ !matches!(self.partial_cmp(other), None | Some(Greater))
986
}
987
988
/// This method tests greater than (for `self` and `other`) and is used by the `>` operator.
0 commit comments