Skip to content

Commit 50340b4

Browse files
authored
Merge pull request #2651 from rhogenson/total-cmp
Use float total_cmp instead of partial_cmp to get a total order.
2 parents d660fad + f3733a8 commit 50340b4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

graphics/src/damage.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@ pub fn list<T>(
4545
/// Groups the given damage regions that are close together inside the given
4646
/// bounds.
4747
pub fn group(mut damage: Vec<Rectangle>, bounds: Rectangle) -> Vec<Rectangle> {
48-
use std::cmp::Ordering;
49-
5048
const AREA_THRESHOLD: f32 = 20_000.0;
5149

5250
damage.sort_by(|a, b| {
5351
a.center()
5452
.distance(Point::ORIGIN)
55-
.partial_cmp(&b.center().distance(Point::ORIGIN))
56-
.unwrap_or(Ordering::Equal)
53+
.total_cmp(&b.center().distance(Point::ORIGIN))
5754
});
5855

5956
let mut output = Vec::new();

0 commit comments

Comments
 (0)