diff --git a/wgpu-hal/src/auxil/dxgi/result.rs b/wgpu-hal/src/auxil/dxgi/result.rs index 256e08278..f3d77e27b 100644 --- a/wgpu-hal/src/auxil/dxgi/result.rs +++ b/wgpu-hal/src/auxil/dxgi/result.rs @@ -1,28 +1,28 @@ -use windows::Win32::{Foundation, Graphics::Dxgi}; - -pub(crate) trait HResult { - fn into_device_result(self, description: &str) -> Result; -} -impl HResult for windows::core::Result { - fn into_device_result(self, description: &str) -> Result { - #![allow(unreachable_code)] - - self.map_err(|err| { - log::error!("{description} failed: {err}"); - - match err.code() { - Foundation::E_OUTOFMEMORY => crate::DeviceError::OutOfMemory, - Dxgi::DXGI_ERROR_DEVICE_RESET | Dxgi::DXGI_ERROR_DEVICE_REMOVED => { - #[cfg(feature = "device_lost_panic")] - panic!("{description} failed: Device lost ({err})"); - crate::DeviceError::Lost - } - _ => { - #[cfg(feature = "internal_error_panic")] - panic!("{description} failed: {err}"); - crate::DeviceError::Unexpected - } - } - }) - } -} +use windows::Win32::{Foundation, Graphics::Dxgi}; + +pub(crate) trait HResult { + fn into_device_result(self, description: &str) -> Result; +} +impl HResult for windows::core::Result { + fn into_device_result(self, description: &str) -> Result { + #![allow(unreachable_code)] + + self.map_err(|err| { + log::error!("{description} failed: {err}"); + + match err.code() { + Foundation::E_OUTOFMEMORY => crate::DeviceError::OutOfMemory, + Dxgi::DXGI_ERROR_DEVICE_RESET | Dxgi::DXGI_ERROR_DEVICE_REMOVED => { + #[cfg(feature = "device_lost_panic")] + panic!("{description} failed: Device lost ({err})"); + crate::DeviceError::Lost + } + _ => { + #[cfg(feature = "internal_error_panic")] + panic!("{description} failed: {err}"); + crate::DeviceError::Unexpected + } + } + }) + } +}