clean up PyComparisonOp::map_eq
@@ -776,24 +776,17 @@ impl PyComparisonOp {
/// is `Ne` and `f()` returns true. Otherwise returns `None`.
#[inline]
pub fn map_eq(self, f: impl FnOnce() -> bool) -> Option<bool> {
- match self {
- Self::Eq => {
- if f() {
- Some(true)
- } else {
- None
- }
- }
- Self::Ne => {
+ let eq = match self {
+ Self::Eq => true,
+ Self::Ne => false,
+ _ => return None,
+ };
if f() {
- Some(false)
+ Some(eq)
} else {
None
}
}
- _ => None,
- }
- }
}
#[pyimpl]
