Skip to content

Commit 6626378

Browse files
[wgpu-core]: Remove x_instead_of_y exceptions (gfx-rs#7598)
1 parent 33a0d2b commit 6626378

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

wgpu-core/src/lock/observing.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@
2828
//!
2929
//! [`lock/rank.rs`]: ../../../src/wgpu_core/lock/rank.rs.html
3030
31-
#![allow(clippy::std_instead_of_alloc, clippy::std_instead_of_core)]
32-
31+
use alloc::{format, string::String};
32+
use core::{cell::RefCell, panic::Location};
3333
use std::{
34-
cell::RefCell,
35-
format,
3634
fs::File,
37-
panic::Location,
3835
path::{Path, PathBuf},
39-
string::String,
4036
};
4137

4238
use super::rank::{LockRank, LockRankSet};
@@ -86,22 +82,22 @@ impl<T> Mutex<T> {
8682
}
8783
}
8884

89-
impl<'a, T> std::ops::Deref for MutexGuard<'a, T> {
85+
impl<'a, T> core::ops::Deref for MutexGuard<'a, T> {
9086
type Target = T;
9187

9288
fn deref(&self) -> &Self::Target {
9389
self.inner.deref()
9490
}
9591
}
9692

97-
impl<'a, T> std::ops::DerefMut for MutexGuard<'a, T> {
93+
impl<'a, T> core::ops::DerefMut for MutexGuard<'a, T> {
9894
fn deref_mut(&mut self) -> &mut Self::Target {
9995
self.inner.deref_mut()
10096
}
10197
}
10298

103-
impl<T: std::fmt::Debug> std::fmt::Debug for Mutex<T> {
104-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
99+
impl<T: core::fmt::Debug> core::fmt::Debug for Mutex<T> {
100+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
105101
self.inner.fmt(f)
106102
}
107103
}
@@ -175,29 +171,29 @@ impl<'a, T> RwLockWriteGuard<'a, T> {
175171
}
176172
}
177173

178-
impl<T: std::fmt::Debug> std::fmt::Debug for RwLock<T> {
179-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
174+
impl<T: core::fmt::Debug> core::fmt::Debug for RwLock<T> {
175+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
180176
self.inner.fmt(f)
181177
}
182178
}
183179

184-
impl<'a, T> std::ops::Deref for RwLockReadGuard<'a, T> {
180+
impl<'a, T> core::ops::Deref for RwLockReadGuard<'a, T> {
185181
type Target = T;
186182

187183
fn deref(&self) -> &Self::Target {
188184
self.inner.deref()
189185
}
190186
}
191187

192-
impl<'a, T> std::ops::Deref for RwLockWriteGuard<'a, T> {
188+
impl<'a, T> core::ops::Deref for RwLockWriteGuard<'a, T> {
193189
type Target = T;
194190

195191
fn deref(&self) -> &Self::Target {
196192
self.inner.deref()
197193
}
198194
}
199195

200-
impl<'a, T> std::ops::DerefMut for RwLockWriteGuard<'a, T> {
196+
impl<'a, T> core::ops::DerefMut for RwLockWriteGuard<'a, T> {
201197
fn deref_mut(&mut self) -> &mut Self::Target {
202198
self.inner.deref_mut()
203199
}
@@ -275,7 +271,7 @@ fn acquire(new_rank: LockRank, location: &'static Location<'static>) -> Option<H
275271
log.write_acquisition(held_lock, new_rank, location);
276272
}
277273

278-
std::mem::replace(
274+
core::mem::replace(
279275
held_lock,
280276
Some(HeldLock {
281277
rank: new_rank,
@@ -482,7 +478,7 @@ impl LockRankSet {
482478
}
483479
}
484480

485-
/// Convenience for `std::ptr::from_ref(t) as usize`.
481+
/// Convenience for `core::ptr::from_ref(t) as usize`.
486482
fn addr<T>(t: &T) -> usize {
487-
std::ptr::from_ref(t) as usize
483+
core::ptr::from_ref(t) as usize
488484
}

0 commit comments

Comments
 (0)