1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -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:
Emil Ernerfeldt
2026-08-06 04:19:13 -07:00
committed by GitHub
parent 2a5f3d99b5
commit 6aea7eff94
176 changed files with 633 additions and 615 deletions

View File

@@ -1,5 +1,5 @@
use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use std::fmt;
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use crate::Vec2b;
@@ -322,7 +322,7 @@ impl Vec2 {
}
}
impl std::ops::Index<usize> for Vec2 {
impl core::ops::Index<usize> for Vec2 {
type Output = f32;
#[inline(always)]
@@ -335,7 +335,7 @@ impl std::ops::Index<usize> for Vec2 {
}
}
impl std::ops::IndexMut<usize> for Vec2 {
impl core::ops::IndexMut<usize> for Vec2 {
#[inline(always)]
fn index_mut(&mut self, index: usize) -> &mut f32 {
match index {
@@ -514,7 +514,7 @@ mod test {
#[test]
fn test_vec2() {
use std::f32::consts::TAU;
use core::f32::consts::TAU;
assert_eq!(Vec2::ZERO.angle(), 0.0);
assert_eq!(Vec2::angled(0.0).angle(), 0.0);
@@ -547,7 +547,7 @@ mod test {
#[test]
fn test_vec2_normalized() {
fn generate_spiral(n: usize, start: Vec2, end: Vec2) -> impl Iterator<Item = Vec2> {
let angle_step = 2.0 * std::f32::consts::PI / n as f32;
let angle_step = 2.0 * core::f32::consts::PI / n as f32;
let radius_step = (end.length() - start.length()) / n as f32;
(0..n).map(move |i| {