Skip to content

Commit 0e61daa

Browse files
committed
fix: use a stable sort in sortf function
1 parent 8be465b commit 0e61daa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern crate std;
2929
extern crate alloc;
3030

3131
use alloc::vec::Vec;
32-
use core::{cmp::Ordering, fmt};
32+
use core::fmt;
3333
use robust::orient2d;
3434

3535
/// Near-duplicate points (where both `x` and `y` only differ within this value)
@@ -465,7 +465,7 @@ fn find_seed_triangle(points: &[Point]) -> Option<(usize, usize, usize)> {
465465
}
466466

467467
fn sortf(f: &mut [(usize, f64)]) {
468-
f.sort_unstable_by(|&(_, da), &(_, db)| da.partial_cmp(&db).unwrap_or(Ordering::Equal));
468+
f.sort_by(|(_, da), (_, db)| da.total_cmp(db));
469469
}
470470

471471
/// Order collinear points by dx (or dy if all x are identical) and return the list as a hull

0 commit comments

Comments
 (0)