Skip to content

Commit

Permalink
fix: use total_cmp where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored and ryanabx committed Dec 23, 2024
1 parent 7ddcfef commit c1edb1a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Linear {
let (Ok(index) | Err(index)) =
self.stops.binary_search_by(|stop| match stop {
None => Ordering::Greater,
Some(stop) => stop.offset.partial_cmp(&offset).unwrap(),
Some(stop) => stop.offset.total_cmp(&offset),
});

if index < 8 {
Expand Down
3 changes: 1 addition & 2 deletions graphics/src/damage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ pub fn group(mut damage: Vec<Rectangle>, bounds: Rectangle) -> Vec<Rectangle> {
damage.sort_by(|a, b| {
a.center()
.distance(Point::ORIGIN)
.partial_cmp(&b.center().distance(Point::ORIGIN))
.unwrap_or(Ordering::Equal)
.total_cmp(&b.center().distance(Point::ORIGIN))
});

let mut output = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion graphics/src/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Linear {
let (Ok(index) | Err(index)) =
self.stops.binary_search_by(|stop| match stop {
None => Ordering::Greater,
Some(stop) => stop.offset.partial_cmp(&offset).unwrap(),
Some(stop) => stop.offset.total_cmp(&offset),
});

if index < 8 {
Expand Down

0 comments on commit c1edb1a

Please sign in to comment.