From 89d34e15134ef33f421cc77559bcc5de4d6c890d Mon Sep 17 00:00:00 2001 From: Junkui Zhang <364772080@qq.com> Date: Mon, 28 Jul 2025 17:44:40 +0800 Subject: [PATCH] clippy --- crates/gpui/src/platform.rs | 2 +- .../gpui/src/platform/windows/directx_renderer.rs | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index f0b9be68bb..76a5eb4c02 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -13,7 +13,7 @@ mod mac; any(target_os = "linux", target_os = "freebsd"), any(feature = "x11", feature = "wayland") ), - feature = "macos-blade" + all(target_os = "macos", feature = "macos-blade") ))] mod blade; diff --git a/crates/gpui/src/platform/windows/directx_renderer.rs b/crates/gpui/src/platform/windows/directx_renderer.rs index d261bf1b4c..6e1ba13de0 100644 --- a/crates/gpui/src/platform/windows/directx_renderer.rs +++ b/crates/gpui/src/platform/windows/directx_renderer.rs @@ -1049,7 +1049,7 @@ fn get_device( let device_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_DEBUG; #[cfg(not(debug_assertions))] let device_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; - Ok(unsafe { + unsafe { D3D11CreateDevice( adapter, D3D_DRIVER_TYPE_UNKNOWN, @@ -1062,8 +1062,9 @@ fn get_device( device, None, context, - )? - }) + )?; + } + Ok(()) } #[cfg(not(feature = "enable-renderdoc"))] @@ -1560,11 +1561,9 @@ mod nvidia { unsafe { // Try to load the NVIDIA driver DLL #[cfg(target_pointer_width = "64")] - let nvidia_dll = - LoadLibraryA(s!("nvapi64.dll")).context(format!("Can't load nvapi64.dll"))?; + let nvidia_dll = LoadLibraryA(s!("nvapi64.dll")).context("Can't load nvapi64.dll")?; #[cfg(target_pointer_width = "32")] - let nvidia_dll = - LoadLibraryA(s!("nvapi.dll")).context(format!("Can't load nvapi.dll"))?; + let nvidia_dll = LoadLibraryA(s!("nvapi.dll")).context("Can't load nvapi.dll")?; let nvapi_query_addr = GetProcAddress(nvidia_dll, s!("nvapi_QueryInterface")) .ok_or_else(|| anyhow::anyhow!("Failed to get nvapi_QueryInterface address"))?; @@ -1614,7 +1613,7 @@ mod amd { }; // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/blob/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/inc/amd_ags.h#L145 - const AGS_CURRENT_VERSION: i32 = (6 << 22) | (3 << 12) | 0; + const AGS_CURRENT_VERSION: i32 = (6 << 22) | (3 << 12); // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/blob/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/inc/amd_ags.h#L204 // This is an opaque type, using struct to represent it properly for FFI