1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Use Rust edition 2024 (#7280)

This commit is contained in:
Emil Ernerfeldt
2025-06-30 14:01:57 +02:00
committed by GitHub
parent 962c8e26a8
commit b2995dcb83
190 changed files with 427 additions and 388 deletions

View File

@@ -1,6 +1,6 @@
//! One- and two-dimensional alignment ([`Align::Center`], [`Align2::LEFT_TOP`] etc).
use crate::{pos2, vec2, Pos2, Rangef, Rect, Vec2};
use crate::{Pos2, Rangef, Rect, Vec2, pos2, vec2};
/// left/center/right or top/center/bottom alignment for e.g. anchors and layouts.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]

View File

@@ -137,11 +137,7 @@ pub fn exponential_in(t: f32) -> f32 {
/// There is a small discontinuity at 1.
#[inline]
pub fn exponential_out(t: f32) -> f32 {
if t == 1. {
t
} else {
1. - powf(2.0, -10. * t)
}
if t == 1. { t } else { 1. - powf(2.0, -10. * t) }
}
/// <https://easings.net/#easeInOutExpo>

View File

@@ -44,7 +44,7 @@ mod vec2b;
pub use self::{
align::{Align, Align2},
gui_rounding::{GuiRounding, GUI_ROUNDING},
gui_rounding::{GUI_ROUNDING, GuiRounding},
history::History,
numeric::*,
ordered_float::*,
@@ -182,11 +182,7 @@ where
);
let t = (x - *from.start()) / (*from.end() - *from.start());
// Ensure no numerical inaccuracies sneak in:
if T::ONE <= t {
*to.end()
} else {
lerp(to, t)
}
if T::ONE <= t { *to.end() } else { lerp(to, t) }
}
}

View File

@@ -3,7 +3,7 @@ use std::{
ops::{Add, AddAssign, MulAssign, Sub, SubAssign},
};
use crate::{lerp, Div, Mul, Vec2};
use crate::{Div, Mul, Vec2, lerp};
/// A position on screen.
///

View File

@@ -1,6 +1,6 @@
use std::fmt;
use crate::{lerp, pos2, vec2, Div, Mul, Pos2, Rangef, Rot2, Vec2};
use crate::{Div, Mul, Pos2, Rangef, Rot2, Vec2, lerp, pos2, vec2};
/// A rectangular region of space.
///

View File

@@ -1,4 +1,4 @@
use crate::{pos2, remap, remap_clamp, Pos2, Rect, Vec2};
use crate::{Pos2, Rect, Vec2, pos2, remap, remap_clamp};
/// Linearly transforms positions from one [`Rect`] to another.
///

View File

@@ -170,11 +170,7 @@ impl Vec2 {
#[inline(always)]
pub fn normalized(self) -> Self {
let len = self.length();
if len <= 0.0 {
self
} else {
self / len
}
if len <= 0.0 { self } else { self / len }
}
/// Checks if `self` has length `1.0` up to a precision of `1e-6`.