mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Enable the clippy::std_instead_of_core lint (#8394)
Prefer `core::` over `std::` where either work * Part of https://github.com/emilk/egui/issues/5735
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
#![expect(clippy::float_cmp)]
|
||||
|
||||
use std::ops::{Add, Div, Mul, RangeInclusive, Sub};
|
||||
use core::ops::{Add, Div, Mul, RangeInclusive, Sub};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -269,7 +269,7 @@ fn test_format() {
|
||||
assert_eq!(format_with_minimum_decimals(3.14, 2), "3.14");
|
||||
assert_eq!(format_with_minimum_decimals(3.14, 3), "3.140");
|
||||
assert_eq!(
|
||||
format_with_minimum_decimals(std::f64::consts::PI, 2),
|
||||
format_with_minimum_decimals(core::f64::consts::PI, 2),
|
||||
"3.14159"
|
||||
);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ impl_num_ext!(Pos2);
|
||||
|
||||
/// Wrap angle to `[-PI, PI]` range.
|
||||
pub fn normalized_angle(mut angle: f32) -> f32 {
|
||||
use std::f32::consts::{PI, TAU};
|
||||
use core::f32::consts::{PI, TAU};
|
||||
angle %= TAU;
|
||||
if angle > PI {
|
||||
angle -= TAU;
|
||||
@@ -385,7 +385,7 @@ fn test_normalized_angle() {
|
||||
};
|
||||
}
|
||||
|
||||
use std::f32::consts::TAU;
|
||||
use core::f32::consts::TAU;
|
||||
almost_eq!(normalized_angle(-3.0 * TAU), 0.0);
|
||||
almost_eq!(normalized_angle(-2.3 * TAU), -0.3 * TAU);
|
||||
almost_eq!(normalized_angle(-TAU), 0.0);
|
||||
|
||||
Reference in New Issue
Block a user