Skip to content

Commit

Permalink
fix(style): use {f32,usize}::midpoint when appropriate
Browse files Browse the repository at this point in the history
style: use `f32::midpoint()`
  • Loading branch information
samueltardieu committed Mar 2, 2025
1 parent f29cb9c commit 811f497
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/gps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ impl Coords {

#[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
fn distance_in_meters(&self, other: &Self) -> u64 {
let x =
(other.lon_rad() - self.lon_rad()) * ((other.lat_rad() + self.lat_rad()) / 2.0).cos();
let x = (other.lon_rad() - self.lon_rad())
* f32::midpoint(other.lat_rad(), self.lat_rad()).cos();
let y = other.lat_rad() - self.lat_rad();
(x.hypot(y) * 6_371_000.0).round() as u64
}
Expand Down

0 comments on commit 811f497

Please sign in to comment.