From 816d6db93e2c0081011cd3bb5234f5b1efd460a5 Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Sun, 9 Aug 2026 06:33:31 +0800 Subject: [PATCH] fix(gpui_macos): silence const-in-pattern warnings in surface format check Compare the pixel format with == instead of match patterns to avoid non_upper_case_globals warnings from the CoreVideo constants. --- Cargo.lock | 1 + crates/gpui_macos/src/metal_renderer.rs | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17c8396e18..6cc20aba28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2762,6 +2762,7 @@ name = "gpui_widgets" version = "0.1.0" dependencies = [ "anyhow", + "core-video", "gpui", "gpui_elements", "gpui_platform", diff --git a/crates/gpui_macos/src/metal_renderer.rs b/crates/gpui_macos/src/metal_renderer.rs index 4ff9ac4e6e..ae108fbb76 100644 --- a/crates/gpui_macos/src/metal_renderer.rs +++ b/crates/gpui_macos/src/metal_renderer.rs @@ -1840,13 +1840,14 @@ impl MetalRenderer { DevicePixels::from(surface.image_buffer.get_height() as i32), ); - let is_bgra = match surface.image_buffer.get_pixel_format() { - kCVPixelFormatType_420YpCbCr8BiPlanarFullRange => false, - kCVPixelFormatType_32BGRA => true, - other => { - log::error!("unsupported surface pixel format: {other}"); - return false; - } + let pixel_format = surface.image_buffer.get_pixel_format(); + let is_bgra = if pixel_format == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange { + false + } else if pixel_format == kCVPixelFormatType_32BGRA { + true + } else { + log::error!("unsupported surface pixel format: {pixel_format}"); + return false; }; // Y (or the whole BGRA image) texture from plane 0.