]>
git.lizzy.rs Git - rust.git/commit
Auto merge of #49881 - varkor:partialord-opt, r=Manishearth
Fix derive(PartialOrd) and optimise final field operation
```rust
// Before (`lt` on 2-field struct)
self.f1 < other.f1 || (!(other.f1 < self.f1) &&
(self.f2 < other.f2 || (!(other.f2 < self.f2) &&
(false)
))
)
// After
self.f1 < other.f1 || (!(other.f1 < self.f1) &&
self.f2 < other.f2
)
// Before (`le` on 2-field struct)
self.f1 < other.f1 || (!(other.f1 < self.f1) &&
(self.f2 < other.f2 || (!(other.f2 < self.f2) &&
(true)
))
)
// After
self.f1 < other.f1 || (self.f1 == other.f1 &&
self.f2 <= other.f2
)
```
(The big diff is mainly because of a past faulty rustfmt application that I corrected 😒)
Fixes #49650 and fixes #49505.