mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40: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:
@@ -5,7 +5,7 @@ use epaint::{
|
||||
Tessellator, TextureAtlas, Vec2, pos2, tessellator::Path,
|
||||
};
|
||||
|
||||
use std::hint::black_box;
|
||||
use core::hint::black_box;
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; // Much faster allocator
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
use core::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
|
||||
use ecolor::Color32;
|
||||
use emath::{Pos2, Rect};
|
||||
@@ -25,7 +26,7 @@ impl Default for ColorMode {
|
||||
}
|
||||
|
||||
impl Debug for ColorMode {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
Self::Solid(arg0) => f.debug_tuple("Solid").field(arg0).finish(),
|
||||
Self::UV(_arg0) => f.debug_tuple("UV").field(&"<closure>").finish(),
|
||||
|
||||
@@ -99,7 +99,7 @@ impl CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add for CornerRadius {
|
||||
impl core::ops::Add for CornerRadius {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
@@ -112,7 +112,7 @@ impl std::ops::Add for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add<u8> for CornerRadius {
|
||||
impl core::ops::Add<u8> for CornerRadius {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn add(self, rhs: u8) -> Self {
|
||||
@@ -125,7 +125,7 @@ impl std::ops::Add<u8> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign for CornerRadius {
|
||||
impl core::ops::AddAssign for CornerRadius {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
*self = Self {
|
||||
@@ -137,7 +137,7 @@ impl std::ops::AddAssign for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<u8> for CornerRadius {
|
||||
impl core::ops::AddAssign<u8> for CornerRadius {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, rhs: u8) {
|
||||
*self = Self {
|
||||
@@ -149,7 +149,7 @@ impl std::ops::AddAssign<u8> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub for CornerRadius {
|
||||
impl core::ops::Sub for CornerRadius {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
@@ -162,7 +162,7 @@ impl std::ops::Sub for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub<u8> for CornerRadius {
|
||||
impl core::ops::Sub<u8> for CornerRadius {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn sub(self, rhs: u8) -> Self {
|
||||
@@ -175,7 +175,7 @@ impl std::ops::Sub<u8> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::SubAssign for CornerRadius {
|
||||
impl core::ops::SubAssign for CornerRadius {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, rhs: Self) {
|
||||
*self = Self {
|
||||
@@ -187,7 +187,7 @@ impl std::ops::SubAssign for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::SubAssign<u8> for CornerRadius {
|
||||
impl core::ops::SubAssign<u8> for CornerRadius {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, rhs: u8) {
|
||||
*self = Self {
|
||||
@@ -199,7 +199,7 @@ impl std::ops::SubAssign<u8> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Div<f32> for CornerRadius {
|
||||
impl core::ops::Div<f32> for CornerRadius {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn div(self, rhs: f32) -> Self {
|
||||
@@ -212,7 +212,7 @@ impl std::ops::Div<f32> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::DivAssign<f32> for CornerRadius {
|
||||
impl core::ops::DivAssign<f32> for CornerRadius {
|
||||
#[inline]
|
||||
fn div_assign(&mut self, rhs: f32) {
|
||||
*self = Self {
|
||||
@@ -224,7 +224,7 @@ impl std::ops::DivAssign<f32> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<f32> for CornerRadius {
|
||||
impl core::ops::Mul<f32> for CornerRadius {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn mul(self, rhs: f32) -> Self {
|
||||
@@ -237,7 +237,7 @@ impl std::ops::Mul<f32> for CornerRadius {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::MulAssign<f32> for CornerRadius {
|
||||
impl core::ops::MulAssign<f32> for CornerRadius {
|
||||
#[inline]
|
||||
fn mul_assign(&mut self, rhs: f32) {
|
||||
*self = Self {
|
||||
|
||||
@@ -111,7 +111,7 @@ impl CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add for CornerRadiusF32 {
|
||||
impl core::ops::Add for CornerRadiusF32 {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
@@ -124,7 +124,7 @@ impl std::ops::Add for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign for CornerRadiusF32 {
|
||||
impl core::ops::AddAssign for CornerRadiusF32 {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
*self = Self {
|
||||
@@ -136,7 +136,7 @@ impl std::ops::AddAssign for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<f32> for CornerRadiusF32 {
|
||||
impl core::ops::AddAssign<f32> for CornerRadiusF32 {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, rhs: f32) {
|
||||
*self = Self {
|
||||
@@ -148,7 +148,7 @@ impl std::ops::AddAssign<f32> for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub for CornerRadiusF32 {
|
||||
impl core::ops::Sub for CornerRadiusF32 {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
@@ -161,7 +161,7 @@ impl std::ops::Sub for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::SubAssign for CornerRadiusF32 {
|
||||
impl core::ops::SubAssign for CornerRadiusF32 {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, rhs: Self) {
|
||||
*self = Self {
|
||||
@@ -173,7 +173,7 @@ impl std::ops::SubAssign for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::SubAssign<f32> for CornerRadiusF32 {
|
||||
impl core::ops::SubAssign<f32> for CornerRadiusF32 {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, rhs: f32) {
|
||||
*self = Self {
|
||||
@@ -185,7 +185,7 @@ impl std::ops::SubAssign<f32> for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Div<f32> for CornerRadiusF32 {
|
||||
impl core::ops::Div<f32> for CornerRadiusF32 {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn div(self, rhs: f32) -> Self {
|
||||
@@ -198,7 +198,7 @@ impl std::ops::Div<f32> for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::DivAssign<f32> for CornerRadiusF32 {
|
||||
impl core::ops::DivAssign<f32> for CornerRadiusF32 {
|
||||
#[inline]
|
||||
fn div_assign(&mut self, rhs: f32) {
|
||||
*self = Self {
|
||||
@@ -210,7 +210,7 @@ impl std::ops::DivAssign<f32> for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<f32> for CornerRadiusF32 {
|
||||
impl core::ops::Mul<f32> for CornerRadiusF32 {
|
||||
type Output = Self;
|
||||
#[inline]
|
||||
fn mul(self, rhs: f32) -> Self {
|
||||
@@ -223,7 +223,7 @@ impl std::ops::Mul<f32> for CornerRadiusF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::MulAssign<f32> for CornerRadiusF32 {
|
||||
impl core::ops::MulAssign<f32> for CornerRadiusF32 {
|
||||
#[inline]
|
||||
fn mul_assign(&mut self, rhs: f32) {
|
||||
*self = Self {
|
||||
|
||||
@@ -301,7 +301,7 @@ impl ColorImage {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Index<(usize, usize)> for ColorImage {
|
||||
impl core::ops::Index<(usize, usize)> for ColorImage {
|
||||
type Output = Color32;
|
||||
|
||||
#[inline]
|
||||
@@ -312,7 +312,7 @@ impl std::ops::Index<(usize, usize)> for ColorImage {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::IndexMut<(usize, usize)> for ColorImage {
|
||||
impl core::ops::IndexMut<(usize, usize)> for ColorImage {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut Color32 {
|
||||
let [w, h] = self.size;
|
||||
@@ -335,8 +335,8 @@ impl From<Arc<ColorImage>> for ImageData {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ColorImage {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ColorImage {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("ColorImage")
|
||||
.field("size", &self.size)
|
||||
.field("pixel-count", &self.pixels.len())
|
||||
|
||||
@@ -120,7 +120,7 @@ impl From<Vec2> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin + Margin`
|
||||
impl std::ops::Add for Margin {
|
||||
impl core::ops::Add for Margin {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -135,7 +135,7 @@ impl std::ops::Add for Margin {
|
||||
}
|
||||
|
||||
/// `Margin + i8`
|
||||
impl std::ops::Add<i8> for Margin {
|
||||
impl core::ops::Add<i8> for Margin {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -150,7 +150,7 @@ impl std::ops::Add<i8> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin += i8`
|
||||
impl std::ops::AddAssign<i8> for Margin {
|
||||
impl core::ops::AddAssign<i8> for Margin {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, v: i8) {
|
||||
*self = *self + v;
|
||||
@@ -158,7 +158,7 @@ impl std::ops::AddAssign<i8> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin * f32`
|
||||
impl std::ops::Mul<f32> for Margin {
|
||||
impl core::ops::Mul<f32> for Margin {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -173,7 +173,7 @@ impl std::ops::Mul<f32> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin *= f32`
|
||||
impl std::ops::MulAssign<f32> for Margin {
|
||||
impl core::ops::MulAssign<f32> for Margin {
|
||||
#[inline]
|
||||
fn mul_assign(&mut self, v: f32) {
|
||||
*self = *self * v;
|
||||
@@ -181,7 +181,7 @@ impl std::ops::MulAssign<f32> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin / f32`
|
||||
impl std::ops::Div<f32> for Margin {
|
||||
impl core::ops::Div<f32> for Margin {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -192,7 +192,7 @@ impl std::ops::Div<f32> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin /= f32`
|
||||
impl std::ops::DivAssign<f32> for Margin {
|
||||
impl core::ops::DivAssign<f32> for Margin {
|
||||
#[inline]
|
||||
fn div_assign(&mut self, v: f32) {
|
||||
*self = *self / v;
|
||||
@@ -200,7 +200,7 @@ impl std::ops::DivAssign<f32> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin - Margin`
|
||||
impl std::ops::Sub for Margin {
|
||||
impl core::ops::Sub for Margin {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -215,7 +215,7 @@ impl std::ops::Sub for Margin {
|
||||
}
|
||||
|
||||
/// `Margin - i8`
|
||||
impl std::ops::Sub<i8> for Margin {
|
||||
impl core::ops::Sub<i8> for Margin {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -230,7 +230,7 @@ impl std::ops::Sub<i8> for Margin {
|
||||
}
|
||||
|
||||
/// `Margin -= i8`
|
||||
impl std::ops::SubAssign<i8> for Margin {
|
||||
impl core::ops::SubAssign<i8> for Margin {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, v: i8) {
|
||||
*self = *self - v;
|
||||
@@ -238,7 +238,7 @@ impl std::ops::SubAssign<i8> for Margin {
|
||||
}
|
||||
|
||||
/// `Rect + Margin`
|
||||
impl std::ops::Add<Margin> for Rect {
|
||||
impl core::ops::Add<Margin> for Rect {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -251,7 +251,7 @@ impl std::ops::Add<Margin> for Rect {
|
||||
}
|
||||
|
||||
/// `Rect += Margin`
|
||||
impl std::ops::AddAssign<Margin> for Rect {
|
||||
impl core::ops::AddAssign<Margin> for Rect {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, margin: Margin) {
|
||||
*self = *self + margin;
|
||||
@@ -259,7 +259,7 @@ impl std::ops::AddAssign<Margin> for Rect {
|
||||
}
|
||||
|
||||
/// `Rect - Margin`
|
||||
impl std::ops::Sub<Margin> for Rect {
|
||||
impl core::ops::Sub<Margin> for Rect {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -272,7 +272,7 @@ impl std::ops::Sub<Margin> for Rect {
|
||||
}
|
||||
|
||||
/// `Rect -= Margin`
|
||||
impl std::ops::SubAssign<Margin> for Rect {
|
||||
impl core::ops::SubAssign<Margin> for Rect {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, margin: Margin) {
|
||||
*self = *self - margin;
|
||||
|
||||
@@ -111,7 +111,7 @@ impl From<Vec2> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 + MarginF32`
|
||||
impl std::ops::Add for MarginF32 {
|
||||
impl core::ops::Add for MarginF32 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -126,7 +126,7 @@ impl std::ops::Add for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 + f32`
|
||||
impl std::ops::Add<f32> for MarginF32 {
|
||||
impl core::ops::Add<f32> for MarginF32 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -141,7 +141,7 @@ impl std::ops::Add<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `Margind += f32`
|
||||
impl std::ops::AddAssign<f32> for MarginF32 {
|
||||
impl core::ops::AddAssign<f32> for MarginF32 {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, v: f32) {
|
||||
self.left += v;
|
||||
@@ -152,7 +152,7 @@ impl std::ops::AddAssign<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 * f32`
|
||||
impl std::ops::Mul<f32> for MarginF32 {
|
||||
impl core::ops::Mul<f32> for MarginF32 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -167,7 +167,7 @@ impl std::ops::Mul<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 *= f32`
|
||||
impl std::ops::MulAssign<f32> for MarginF32 {
|
||||
impl core::ops::MulAssign<f32> for MarginF32 {
|
||||
#[inline]
|
||||
fn mul_assign(&mut self, v: f32) {
|
||||
self.left *= v;
|
||||
@@ -178,7 +178,7 @@ impl std::ops::MulAssign<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 / f32`
|
||||
impl std::ops::Div<f32> for MarginF32 {
|
||||
impl core::ops::Div<f32> for MarginF32 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -193,7 +193,7 @@ impl std::ops::Div<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 /= f32`
|
||||
impl std::ops::DivAssign<f32> for MarginF32 {
|
||||
impl core::ops::DivAssign<f32> for MarginF32 {
|
||||
#[inline]
|
||||
fn div_assign(&mut self, v: f32) {
|
||||
self.left /= v;
|
||||
@@ -204,7 +204,7 @@ impl std::ops::DivAssign<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 - MarginF32`
|
||||
impl std::ops::Sub for MarginF32 {
|
||||
impl core::ops::Sub for MarginF32 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -219,7 +219,7 @@ impl std::ops::Sub for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 - f32`
|
||||
impl std::ops::Sub<f32> for MarginF32 {
|
||||
impl core::ops::Sub<f32> for MarginF32 {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -234,7 +234,7 @@ impl std::ops::Sub<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `MarginF32 -= f32`
|
||||
impl std::ops::SubAssign<f32> for MarginF32 {
|
||||
impl core::ops::SubAssign<f32> for MarginF32 {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, v: f32) {
|
||||
self.left -= v;
|
||||
@@ -245,7 +245,7 @@ impl std::ops::SubAssign<f32> for MarginF32 {
|
||||
}
|
||||
|
||||
/// `Rect + MarginF32`
|
||||
impl std::ops::Add<MarginF32> for Rect {
|
||||
impl core::ops::Add<MarginF32> for Rect {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -258,7 +258,7 @@ impl std::ops::Add<MarginF32> for Rect {
|
||||
}
|
||||
|
||||
/// `Rect += MarginF32`
|
||||
impl std::ops::AddAssign<MarginF32> for Rect {
|
||||
impl core::ops::AddAssign<MarginF32> for Rect {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, margin: MarginF32) {
|
||||
*self = *self + margin;
|
||||
@@ -266,7 +266,7 @@ impl std::ops::AddAssign<MarginF32> for Rect {
|
||||
}
|
||||
|
||||
/// `Rect - MarginF32`
|
||||
impl std::ops::Sub<MarginF32> for Rect {
|
||||
impl core::ops::Sub<MarginF32> for Rect {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -279,7 +279,7 @@ impl std::ops::Sub<MarginF32> for Rect {
|
||||
}
|
||||
|
||||
/// `Rect -= MarginF32`
|
||||
impl std::ops::SubAssign<MarginF32> for Rect {
|
||||
impl core::ops::SubAssign<MarginF32> for Rect {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, margin: MarginF32) {
|
||||
*self = *self - margin;
|
||||
|
||||
@@ -90,9 +90,9 @@ impl Mesh {
|
||||
|
||||
/// Returns the amount of memory used by the vertices and indices.
|
||||
pub fn bytes_used(&self) -> usize {
|
||||
std::mem::size_of::<Self>()
|
||||
+ self.vertices.len() * std::mem::size_of::<Vertex>()
|
||||
+ self.indices.len() * std::mem::size_of::<u32>()
|
||||
core::mem::size_of::<Self>()
|
||||
+ self.vertices.len() * core::mem::size_of::<Vertex>()
|
||||
+ self.indices.len() * core::mem::size_of::<u32>()
|
||||
}
|
||||
|
||||
/// Are all indices within the bounds of the contained vertices?
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const DEADLOCK_DURATION: std::time::Duration = std::time::Duration::from_secs(10);
|
||||
const DEADLOCK_DURATION: core::time::Duration = core::time::Duration::from_secs(10);
|
||||
|
||||
/// Provides interior mutability.
|
||||
///
|
||||
@@ -128,7 +128,7 @@ mod tests {
|
||||
#![expect(clippy::disallowed_methods)] // Ok for tests
|
||||
|
||||
use crate::mutex::Mutex;
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
#[test]
|
||||
fn lock_two_different_mutexes_single_thread() {
|
||||
@@ -161,7 +161,7 @@ mod tests_rwlock {
|
||||
#![expect(clippy::disallowed_methods)] // Ok for tests
|
||||
|
||||
use crate::mutex::RwLock;
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
#[test]
|
||||
fn lock_two_different_rwlocks_single_thread() {
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct Shadow {
|
||||
#[test]
|
||||
fn shadow_size() {
|
||||
assert_eq!(
|
||||
std::mem::size_of::<Shadow>(),
|
||||
core::mem::size_of::<Shadow>(),
|
||||
8,
|
||||
"Shadow changed size! If it shrank - good! Update this test. If it grew - bad! Try to find a way to avoid it."
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![expect(clippy::many_single_char_names)]
|
||||
|
||||
use std::ops::Range;
|
||||
use core::ops::Range;
|
||||
|
||||
use crate::{Color32, PathShape, PathStroke, Shape};
|
||||
use emath::{Pos2, Rect, RectTransform, fast_midpoint};
|
||||
@@ -256,8 +256,8 @@ impl CubicBezierShape {
|
||||
let theta = (-q / (2.0 * r)).acos() / 3.0;
|
||||
|
||||
let t1 = 2.0 * r.cbrt() * theta.cos() + h;
|
||||
let t2 = 2.0 * r.cbrt() * (theta + 120.0 * std::f32::consts::PI / 180.0).cos() + h;
|
||||
let t3 = 2.0 * r.cbrt() * (theta + 240.0 * std::f32::consts::PI / 180.0).cos() + h;
|
||||
let t2 = 2.0 * r.cbrt() * (theta + 120.0 * core::f32::consts::PI / 180.0).cos() + h;
|
||||
let t3 = 2.0 * r.cbrt() * (theta + 240.0 * core::f32::consts::PI / 180.0).cos() + h;
|
||||
|
||||
if t1 > epsilon && t1 < 1.0 - epsilon {
|
||||
return Some(t1);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::{any::Any, sync::Arc};
|
||||
use core::any::Any;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -32,7 +33,7 @@ fn test_viewport_rounding() {
|
||||
let left = Rect::from_min_max(pos2(0.0, 0.0), pos2(100.0, 100.0)).with_max_x(x);
|
||||
let right = Rect::from_min_max(pos2(0.0, 0.0), pos2(100.0, 100.0)).with_min_x(x);
|
||||
|
||||
for pixels_per_point in [0.618, 1.0, std::f32::consts::PI] {
|
||||
for pixels_per_point in [0.618, 1.0, core::f32::consts::PI] {
|
||||
let left = ViewportInPixels::from_points(&left, pixels_per_point, [100, 100]);
|
||||
let right = ViewportInPixels::from_points(&right, pixels_per_point, [100, 100]);
|
||||
assert_eq!(left.left_px + left.width_px, right.left_px);
|
||||
@@ -81,15 +82,15 @@ pub struct PaintCallback {
|
||||
pub callback: Arc<dyn Any + Send + Sync>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for PaintCallback {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for PaintCallback {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("CustomShape")
|
||||
.field("rect", &self.rect)
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::cmp::PartialEq for PaintCallback {
|
||||
impl core::cmp::PartialEq for PaintCallback {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.rect.eq(&other.rect) && Arc::ptr_eq(&self.callback, &other.callback)
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ pub struct RectShape {
|
||||
#[test]
|
||||
fn rect_shape_size() {
|
||||
assert_eq!(
|
||||
std::mem::size_of::<RectShape>(),
|
||||
core::mem::size_of::<RectShape>(),
|
||||
56,
|
||||
"RectShape changed size! If it shrank - good! Update this test. If it grew - bad! Try to find a way to avoid it."
|
||||
);
|
||||
assert!(
|
||||
std::mem::size_of::<RectShape>() <= 64,
|
||||
core::mem::size_of::<RectShape>() <= 64,
|
||||
"RectShape is getting way too big!"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ pub enum Shape {
|
||||
#[test]
|
||||
fn shape_size() {
|
||||
assert_eq!(
|
||||
std::mem::size_of::<Shape>(),
|
||||
core::mem::size_of::<Shape>(),
|
||||
64,
|
||||
"Shape changed size! If it shrank - good! Update this test. If it grew - bad! Try to find a way to avoid it."
|
||||
);
|
||||
assert!(
|
||||
std::mem::size_of::<Shape>() <= 64,
|
||||
core::mem::size_of::<Shape>() <= 64,
|
||||
"Shape is getting way too big!"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ mod tests {
|
||||
|
||||
// 90 degree rotation
|
||||
if let Shape::Text(ts) = &mut t {
|
||||
ts.angle = std::f32::consts::PI / 2.0;
|
||||
ts.angle = core::f32::consts::PI / 2.0;
|
||||
}
|
||||
|
||||
let size_rot = t.visual_bounding_rect().size();
|
||||
|
||||
@@ -26,7 +26,7 @@ impl<T> From<&[T]> for AllocInfo {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add for AllocInfo {
|
||||
impl core::ops::Add for AllocInfo {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
@@ -47,13 +47,13 @@ impl std::ops::Add for AllocInfo {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign for AllocInfo {
|
||||
impl core::ops::AddAssign for AllocInfo {
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
*self = *self + rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl std::iter::Sum for AllocInfo {
|
||||
impl core::iter::Sum for AllocInfo {
|
||||
fn sum<I>(iter: I) -> Self
|
||||
where
|
||||
I: Iterator<Item = Self>,
|
||||
@@ -95,13 +95,13 @@ impl AllocInfo {
|
||||
}
|
||||
|
||||
pub fn from_slice<T>(slice: &[T]) -> Self {
|
||||
use std::mem::size_of;
|
||||
use core::mem::size_of;
|
||||
let element_size = size_of::<T>();
|
||||
Self {
|
||||
element_size: ElementSize::Homogeneous(element_size),
|
||||
num_allocs: 1,
|
||||
num_elements: slice.len(),
|
||||
num_bytes: std::mem::size_of_val(slice),
|
||||
num_bytes: core::mem::size_of_val(slice),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
use core::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
|
||||
use emath::GuiRounding as _;
|
||||
|
||||
@@ -86,9 +87,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl std::hash::Hash for Stroke {
|
||||
impl core::hash::Hash for Stroke {
|
||||
#[inline(always)]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
let Self { width, color } = *self;
|
||||
emath::OrderedFloat(width).hash(state);
|
||||
color.hash(state);
|
||||
|
||||
@@ -1579,7 +1579,7 @@ impl Tessellator {
|
||||
let eased = 2.0 * (percent - percent.powf(2.0)) * ratio + percent.powf(2.0);
|
||||
|
||||
// Scale the ease to the quarter
|
||||
let t = eased * std::f32::consts::FRAC_PI_2;
|
||||
let t = eased * core::f32::consts::FRAC_PI_2;
|
||||
Vec2::new(radius.x * f32::cos(t), radius.y * f32::sin(t))
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -37,7 +37,7 @@ impl PartialEq for CCursor {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add<usize> for CCursor {
|
||||
impl core::ops::Add<usize> for CCursor {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: usize) -> Self::Output {
|
||||
@@ -48,7 +48,7 @@ impl std::ops::Add<usize> for CCursor {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add<CharIndex> for CCursor {
|
||||
impl core::ops::Add<CharIndex> for CCursor {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: CharIndex) -> Self::Output {
|
||||
@@ -59,7 +59,7 @@ impl std::ops::Add<CharIndex> for CCursor {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub<usize> for CCursor {
|
||||
impl core::ops::Sub<usize> for CCursor {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: usize) -> Self::Output {
|
||||
@@ -70,7 +70,7 @@ impl std::ops::Sub<usize> for CCursor {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub<CharIndex> for CCursor {
|
||||
impl core::ops::Sub<CharIndex> for CCursor {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: CharIndex) -> Self::Output {
|
||||
@@ -81,13 +81,13 @@ impl std::ops::Sub<CharIndex> for CCursor {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<usize> for CCursor {
|
||||
impl core::ops::AddAssign<usize> for CCursor {
|
||||
fn add_assign(&mut self, rhs: usize) {
|
||||
self.index = self.index.saturating_add(rhs);
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::SubAssign<usize> for CCursor {
|
||||
impl core::ops::SubAssign<usize> for CCursor {
|
||||
fn sub_assign(&mut self, rhs: usize) {
|
||||
self.index = self.index.saturating_sub(rhs);
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ impl FontFace {
|
||||
font_data: Blob,
|
||||
index: u32,
|
||||
tweak: FontTweak,
|
||||
) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
) -> Result<Self, Box<dyn core::error::Error>> {
|
||||
let font = FontCell::try_new(font_data, |font_data| {
|
||||
let skrifa_font =
|
||||
skrifa::FontRef::from_index(AsRef::<[u8]>::as_ref(font_data.as_ref()), index)?;
|
||||
@@ -414,7 +414,7 @@ impl FontFace {
|
||||
})
|
||||
.flatten();
|
||||
|
||||
Ok::<DependentFontData<'_>, Box<dyn std::error::Error>>(DependentFontData {
|
||||
Ok::<DependentFontData<'_>, Box<dyn core::error::Error>>(DependentFontData {
|
||||
skrifa: skrifa_font,
|
||||
charmap,
|
||||
outline_glyphs: glyphs,
|
||||
@@ -574,7 +574,7 @@ impl FontFace {
|
||||
let axes = font_data.skrifa.axes();
|
||||
// Override the default coordinates with ones specified via FontTweak, then the ones specified directly via the
|
||||
// argument (probably from TextFormat).
|
||||
let settings = std::iter::chain(self.tweak.coords.as_ref(), coords.as_ref());
|
||||
let settings = core::iter::chain(self.tweak.coords.as_ref(), coords.as_ref());
|
||||
let location = axes.location(settings);
|
||||
let location_hash = LocationHash::new(&location);
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::BTreeMap,
|
||||
sync::{
|
||||
Arc,
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
},
|
||||
};
|
||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::{borrow::Cow, collections::BTreeMap, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
TextureAtlas,
|
||||
@@ -60,9 +54,9 @@ impl FontId {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::hash::Hash for FontId {
|
||||
impl core::hash::Hash for FontId {
|
||||
#[inline(always)]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
let Self { size, family } = self;
|
||||
emath::OrderedFloat(*size).hash(state);
|
||||
family.hash(state);
|
||||
@@ -100,8 +94,8 @@ pub enum FontFamily {
|
||||
Name(Arc<str>),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for FontFamily {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Display for FontFamily {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
Self::Monospace => "Monospace".fmt(f),
|
||||
Self::Proportional => "Proportional".fmt(f),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! (Unicode scalar) offset. Mixing the two is a common source of bugs,
|
||||
//! so we use distinct types to keep them apart.
|
||||
|
||||
use std::ops::Range;
|
||||
use core::ops::Range;
|
||||
|
||||
/// A byte offset into a UTF-8 string.
|
||||
///
|
||||
@@ -63,7 +63,7 @@ macro_rules! impl_text_index {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add<usize> for $Type {
|
||||
impl core::ops::Add<usize> for $Type {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -73,7 +73,7 @@ macro_rules! impl_text_index {
|
||||
}
|
||||
|
||||
/// Compose offsets, e.g. a base position plus a relative one.
|
||||
impl std::ops::Add<$Type> for $Type {
|
||||
impl core::ops::Add<$Type> for $Type {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -82,7 +82,7 @@ macro_rules! impl_text_index {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub<usize> for $Type {
|
||||
impl core::ops::Sub<usize> for $Type {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -91,7 +91,7 @@ macro_rules! impl_text_index {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Sub<$Type> for $Type {
|
||||
impl core::ops::Sub<$Type> for $Type {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
@@ -100,30 +100,30 @@ macro_rules! impl_text_index {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<usize> for $Type {
|
||||
impl core::ops::AddAssign<usize> for $Type {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, rhs: usize) {
|
||||
self.0 += rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<$Type> for $Type {
|
||||
impl core::ops::AddAssign<$Type> for $Type {
|
||||
#[inline]
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
self.0 += rhs.0;
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::SubAssign<usize> for $Type {
|
||||
impl core::ops::SubAssign<usize> for $Type {
|
||||
#[inline]
|
||||
fn sub_assign(&mut self, rhs: usize) {
|
||||
self.0 -= rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for $Type {
|
||||
impl core::fmt::Display for $Type {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![expect(clippy::unwrap_used)] // TODO(emilk): remove unwraps
|
||||
|
||||
use core::{iter, ops::Range};
|
||||
use std::sync::Arc;
|
||||
use std::{iter, ops::Range};
|
||||
|
||||
use emath::{Align, GuiRounding as _, NumExt as _, Pos2, Rect, Vec2, pos2, vec2};
|
||||
|
||||
@@ -523,7 +523,7 @@ fn layout_section(
|
||||
/// Iterator that either splits on `'\n'` or yields the whole string once.
|
||||
/// Avoids `Box<dyn Iterator>` and `Vec<&str>` allocation.
|
||||
enum SplitOrWhole<'a> {
|
||||
Split(std::str::Split<'a, char>),
|
||||
Split(core::str::Split<'a, char>),
|
||||
Whole(iter::Once<&'a str>),
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ fn calculate_intrinsic_size(
|
||||
.glyphs
|
||||
.iter()
|
||||
.map(|g| g.line_height)
|
||||
.max_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal))
|
||||
.max_by(|a, b| a.partial_cmp(b).unwrap_or(core::cmp::Ordering::Equal))
|
||||
.unwrap_or(paragraph.empty_paragraph_height);
|
||||
if idx == 0 {
|
||||
height = f32::max(height, job.first_row_min_height);
|
||||
@@ -1437,7 +1437,7 @@ fn shape_text(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::iter;
|
||||
use core::iter;
|
||||
|
||||
use super::{super::*, *};
|
||||
use crate::text::cursor::CCursor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use core::{ops::Range, str::FromStr as _};
|
||||
use std::sync::Arc;
|
||||
use std::{ops::Range, str::FromStr as _};
|
||||
|
||||
use super::{
|
||||
cursor::{CCursor, LayoutCursor},
|
||||
@@ -271,7 +271,7 @@ impl LayoutJob {
|
||||
let Range { start, end } = section.byte_range;
|
||||
assert!(start <= end, "LayoutSection has a reversed byte_range");
|
||||
}
|
||||
for (prev, next) in std::iter::zip(&self.sections, self.sections.iter().skip(1)) {
|
||||
for (prev, next) in core::iter::zip(&self.sections, self.sections.iter().skip(1)) {
|
||||
assert_eq!(
|
||||
prev.byte_range.end, next.byte_range.start,
|
||||
"LayoutSections must be ordered with no gaps and no overlaps"
|
||||
@@ -304,9 +304,9 @@ impl LayoutJob {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::hash::Hash for LayoutJob {
|
||||
impl core::hash::Hash for LayoutJob {
|
||||
#[inline]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
let Self {
|
||||
text,
|
||||
sections,
|
||||
@@ -355,9 +355,9 @@ pub struct LayoutSection {
|
||||
pub format: TextFormat,
|
||||
}
|
||||
|
||||
impl std::hash::Hash for LayoutSection {
|
||||
impl core::hash::Hash for LayoutSection {
|
||||
#[inline]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
let Self {
|
||||
leading_space,
|
||||
byte_range,
|
||||
@@ -462,8 +462,8 @@ impl AsMut<[(font_types::Tag, f32)]> for VariationCoords {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::hash::Hash for VariationCoords {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
impl core::hash::Hash for VariationCoords {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
self.0.len().hash(state);
|
||||
for (tag, coord) in &self.0 {
|
||||
tag.hash(state);
|
||||
@@ -541,9 +541,9 @@ impl Default for TextFormat {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::hash::Hash for TextFormat {
|
||||
impl core::hash::Hash for TextFormat {
|
||||
#[inline]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
let Self {
|
||||
font_id,
|
||||
extra_letter_spacing,
|
||||
@@ -651,9 +651,9 @@ pub struct TextWrapping {
|
||||
pub overflow_character: Option<char>,
|
||||
}
|
||||
|
||||
impl std::hash::Hash for TextWrapping {
|
||||
impl core::hash::Hash for TextWrapping {
|
||||
#[inline]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
let Self {
|
||||
max_width,
|
||||
max_rows,
|
||||
@@ -817,7 +817,7 @@ impl PlacedRow {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for PlacedRow {
|
||||
impl core::ops::Deref for PlacedRow {
|
||||
type Target = Row;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -1126,14 +1126,14 @@ impl AsRef<str> for Galley {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::borrow::Borrow<str> for Galley {
|
||||
impl core::borrow::Borrow<str> for Galley {
|
||||
#[inline]
|
||||
fn borrow(&self) -> &str {
|
||||
self.text()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for Galley {
|
||||
impl core::ops::Deref for Galley {
|
||||
type Target = str;
|
||||
#[inline]
|
||||
fn deref(&self) -> &str {
|
||||
|
||||
@@ -202,7 +202,7 @@ impl TextureAtlas {
|
||||
pub fn take_delta(&mut self) -> Option<ImageDelta> {
|
||||
let texture_options = Self::texture_options();
|
||||
|
||||
let dirty = std::mem::replace(&mut self.dirty, Rectu::NOTHING);
|
||||
let dirty = core::mem::replace(&mut self.dirty, Rectu::NOTHING);
|
||||
if dirty == Rectu::NOTHING {
|
||||
None
|
||||
} else if dirty == Rectu::EVERYTHING {
|
||||
|
||||
@@ -47,9 +47,9 @@ impl PartialEq for TextureHandle {
|
||||
|
||||
impl Eq for TextureHandle {}
|
||||
|
||||
impl std::hash::Hash for TextureHandle {
|
||||
impl core::hash::Hash for TextureHandle {
|
||||
#[inline]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
self.id.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{ImageData, ImageDelta, TextureId};
|
||||
use ahash::{HashMap, HashSet};
|
||||
use core::mem;
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use std::mem;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -100,7 +100,7 @@ impl TextureManager {
|
||||
///
|
||||
/// These should be applied to the painting subsystem each frame.
|
||||
pub fn take_delta(&mut self) -> TexturesDelta {
|
||||
std::mem::take(&mut self.delta)
|
||||
core::mem::take(&mut self.delta)
|
||||
}
|
||||
|
||||
/// Get meta-data about a specific texture.
|
||||
@@ -343,9 +343,9 @@ impl Drop for TexturesDelta {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for TexturesDelta {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
use std::fmt::Write as _;
|
||||
impl core::fmt::Debug for TexturesDelta {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
use core::fmt::Write as _;
|
||||
|
||||
let mut debug_struct = f.debug_struct("TexturesDelta");
|
||||
if !self.set.is_empty() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/// Hash the given value with a predictable hasher.
|
||||
#[inline]
|
||||
pub fn hash(value: impl std::hash::Hash) -> u64 {
|
||||
pub fn hash(value: impl core::hash::Hash) -> u64 {
|
||||
ahash::RandomState::with_seeds(1, 2, 3, 4).hash_one(value)
|
||||
}
|
||||
|
||||
/// Hash the given value with the given hasher.
|
||||
#[inline]
|
||||
pub fn hash_with(value: impl std::hash::Hash, mut hasher: impl std::hash::Hasher) -> u64 {
|
||||
pub fn hash_with(value: impl core::hash::Hash, mut hasher: impl core::hash::Hasher) -> u64 {
|
||||
value.hash(&mut hasher);
|
||||
hasher.finish()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user