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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ impl TSTransform {
|
||||
/// `(0, 0)`, then translates them.
|
||||
pub fn new(translation: Vec2, scaling: f32) -> Self {
|
||||
Self {
|
||||
translation,
|
||||
scaling,
|
||||
translation,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user