[wgpu-core]: Remove x_instead_of_y exceptions (#7598)

This commit is contained in:
Zachary Harrold 2025-04-23 13:17:29 +10:00 committed by GitHub
parent 33a0d2bbfa
commit 66263789bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,15 +28,11 @@
//!
//! [`lock/rank.rs`]: ../../../src/wgpu_core/lock/rank.rs.html
#![allow(clippy::std_instead_of_alloc, clippy::std_instead_of_core)]
use alloc::{format, string::String};
use core::{cell::RefCell, panic::Location};
use std::{
cell::RefCell,
format,
fs::File,
panic::Location,
path::{Path, PathBuf},
string::String,
};
use super::rank::{LockRank, LockRankSet};
@ -86,7 +82,7 @@ impl<T> Mutex<T> {
}
}
impl<'a, T> std::ops::Deref for MutexGuard<'a, T> {
impl<'a, T> core::ops::Deref for MutexGuard<'a, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@ -94,14 +90,14 @@ impl<'a, T> std::ops::Deref for MutexGuard<'a, T> {
}
}
impl<'a, T> std::ops::DerefMut for MutexGuard<'a, T> {
impl<'a, T> core::ops::DerefMut for MutexGuard<'a, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.inner.deref_mut()
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for Mutex<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<T: core::fmt::Debug> core::fmt::Debug for Mutex<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
self.inner.fmt(f)
}
}
@ -175,13 +171,13 @@ impl<'a, T> RwLockWriteGuard<'a, T> {
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for RwLock<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<T: core::fmt::Debug> core::fmt::Debug for RwLock<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
self.inner.fmt(f)
}
}
impl<'a, T> std::ops::Deref for RwLockReadGuard<'a, T> {
impl<'a, T> core::ops::Deref for RwLockReadGuard<'a, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@ -189,7 +185,7 @@ impl<'a, T> std::ops::Deref for RwLockReadGuard<'a, T> {
}
}
impl<'a, T> std::ops::Deref for RwLockWriteGuard<'a, T> {
impl<'a, T> core::ops::Deref for RwLockWriteGuard<'a, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@ -197,7 +193,7 @@ impl<'a, T> std::ops::Deref for RwLockWriteGuard<'a, T> {
}
}
impl<'a, T> std::ops::DerefMut for RwLockWriteGuard<'a, T> {
impl<'a, T> core::ops::DerefMut for RwLockWriteGuard<'a, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.inner.deref_mut()
}
@ -275,7 +271,7 @@ fn acquire(new_rank: LockRank, location: &'static Location<'static>) -> Option<H
log.write_acquisition(held_lock, new_rank, location);
}
std::mem::replace(
core::mem::replace(
held_lock,
Some(HeldLock {
rank: new_rank,
@ -482,7 +478,7 @@ impl LockRankSet {
}
}
/// Convenience for `std::ptr::from_ref(t) as usize`.
/// Convenience for `core::ptr::from_ref(t) as usize`.
fn addr<T>(t: &T) -> usize {
std::ptr::from_ref(t) as usize
core::ptr::from_ref(t) as usize
}