Skip to content

Commit 26c5618

Browse files
authored
Fix CRLF in dxgi.rs (gfx-rs#9067)
1 parent 157cf36 commit 26c5618

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

wgpu-hal/src/auxil/dxgi/result.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
use windows::Win32::{Foundation, Graphics::Dxgi};
2-
3-
pub(crate) trait HResult<O> {
4-
fn into_device_result(self, description: &str) -> Result<O, crate::DeviceError>;
5-
}
6-
impl<T> HResult<T> for windows::core::Result<T> {
7-
fn into_device_result(self, description: &str) -> Result<T, crate::DeviceError> {
8-
#![allow(unreachable_code)]
9-
10-
self.map_err(|err| {
11-
log::error!("{description} failed: {err}");
12-
13-
match err.code() {
14-
Foundation::E_OUTOFMEMORY => crate::DeviceError::OutOfMemory,
15-
Dxgi::DXGI_ERROR_DEVICE_RESET | Dxgi::DXGI_ERROR_DEVICE_REMOVED => {
16-
#[cfg(feature = "device_lost_panic")]
17-
panic!("{description} failed: Device lost ({err})");
18-
crate::DeviceError::Lost
19-
}
20-
_ => {
21-
#[cfg(feature = "internal_error_panic")]
22-
panic!("{description} failed: {err}");
23-
crate::DeviceError::Unexpected
24-
}
25-
}
26-
})
27-
}
28-
}
1+
use windows::Win32::{Foundation, Graphics::Dxgi};
2+
3+
pub(crate) trait HResult<O> {
4+
fn into_device_result(self, description: &str) -> Result<O, crate::DeviceError>;
5+
}
6+
impl<T> HResult<T> for windows::core::Result<T> {
7+
fn into_device_result(self, description: &str) -> Result<T, crate::DeviceError> {
8+
#![allow(unreachable_code)]
9+
10+
self.map_err(|err| {
11+
log::error!("{description} failed: {err}");
12+
13+
match err.code() {
14+
Foundation::E_OUTOFMEMORY => crate::DeviceError::OutOfMemory,
15+
Dxgi::DXGI_ERROR_DEVICE_RESET | Dxgi::DXGI_ERROR_DEVICE_REMOVED => {
16+
#[cfg(feature = "device_lost_panic")]
17+
panic!("{description} failed: Device lost ({err})");
18+
crate::DeviceError::Lost
19+
}
20+
_ => {
21+
#[cfg(feature = "internal_error_panic")]
22+
panic!("{description} failed: {err}");
23+
crate::DeviceError::Unexpected
24+
}
25+
}
26+
})
27+
}
28+
}

0 commit comments

Comments
 (0)