URL: http://github.com/RustPython/RustPython/commit/436f9849503ab838fe2cc59a25ae6517aafec408
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3b9721c commit 436f984Copy full SHA for 436f984
vm/src/types/slot.rs
@@ -776,22 +776,15 @@ impl PyComparisonOp {
776
//github.com/ is `Ne` and `f()` returns true. Otherwise returns `None`.
777
#[inline]
778
pub fn map_eq(self, f: impl FnOnce() -> bool) -> Option<bool> {
779
- match self {
780
- Self::Eq => {
781
- if f() {
782
- Some(true)
783
- } else {
784
- None
785
- }
786
787
- Self::Ne => {
788
789
- Some(false)
790
791
792
793
794
- _ => None,
+ let eq = match self {
+ Self::Eq => true,
+ Self::Ne => false,
+ _ => return None,
+ };
+ if f() {
+ Some(eq)
+ } else {
+ None
795
}
796
797
0 commit comments