Skip to content

[wgpu-core]: Remove x_instead_of_y exceptions #7598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions wgpu-core/src/lock/observing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -86,22 +82,22 @@ 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 {
self.inner.deref()
}
}

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)
}
}
Expand Down Expand Up @@ -175,29 +171,29 @@ 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 {
self.inner.deref()
}
}

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 {
self.inner.deref()
}
}

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()
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
}