1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Enable and fix some more clippy lints (#7426)

One can never have too many lints
This commit is contained in:
Emil Ernerfeldt
2025-08-08 09:57:53 +02:00
committed by GitHub
parent e8e99a0bb6
commit 3024c39eaf
41 changed files with 107 additions and 91 deletions

View File

@@ -134,7 +134,7 @@ impl Align {
if size == f32::INFINITY {
Rangef::new(f32::NEG_INFINITY, f32::INFINITY)
} else {
let left = (min + max) / 2.0 - size / 2.0;
let left = f32::midpoint(min, max) - size / 2.0;
Rangef::new(left, left + size)
}
}

View File

@@ -331,8 +331,8 @@ impl Rect {
#[inline(always)]
pub fn center(&self) -> Pos2 {
Pos2 {
x: (self.min.x + self.max.x) / 2.0,
y: (self.min.y + self.max.y) / 2.0,
x: f32::midpoint(self.min.x, self.max.x),
y: f32::midpoint(self.min.y, self.max.y),
}
}

View File

@@ -43,7 +43,7 @@ pub fn best_in_range_f64(min: f64, max: f64) -> f64 {
if min_exponent.floor() != max_exponent.floor() {
// pick the geometric center of the two:
let exponent = (min_exponent + max_exponent) / 2.0;
let exponent = f64::midpoint(min_exponent, max_exponent);
return 10.0_f64.powi(exponent.round() as i32);
}

View File

@@ -36,8 +36,8 @@ impl TSTransform {
/// `(0, 0)`, then translates them.
pub fn new(translation: Vec2, scaling: f32) -> Self {
Self {
translation,
scaling,
translation,
}
}