]> git.lizzy.rs Git - rust.git/commit
Auto merge of #49881 - varkor:partialord-opt, r=Manishearth
authorbors <bors@rust-lang.org>
Sun, 15 Apr 2018 03:54:15 +0000 (03:54 +0000)
committerbors <bors@rust-lang.org>
Sun, 15 Apr 2018 03:54:15 +0000 (03:54 +0000)
commitbc001fa07f1e44f88b59c74290a2dd916824d33c
treea55b1eb61a3bf7d791bbe40f2833015679abf36e
parentd4d43e248340b6acaf02f4439713c160fd77a846
parent105c5180941f4034fd0d576a1d4c1bb71dd8e077
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.
src/etc/generate-deriving-span-tests.py
src/libsyntax_ext/deriving/generic/mod.rs