fix(cross-platform): cfg 掉的 Windows 路径遗留 dead_code 在 -D warnings 下报错

CI 的 setup-rust-toolchain 默认 RUSTFLAGS=-Dwarnings:非 Windows 下
sample_windows/set_topmost_windows 被 cfg 移除后,其专用字段
(Sampler.pid/last_cpu/last_percent)与常量(SWP_*)成为 dead code。
字段加 cfg_attr(not(windows) allow(dead_code)),常量加 cfg 门控。
This commit is contained in:
2026-09-30 13:15:01 +08:00
parent 22e0c70b90
commit 5783a500e8
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -47,6 +47,11 @@ fn set_topmost_windows(_window: &gpui_kit::Window, _topmost: bool) -> bool {
false
}
// 仅 Windows 采样路径使用;非 Windows 下该路径被 cfg 移除,常量会成为
// dead_code(CI 的 -D warnings 下即错误),按平台放行。
#[cfg(target_os = "windows")]
const SWP_NOSIZE: u32 = 0x0001;
#[cfg(target_os = "windows")]
const SWP_NOMOVE: u32 = 0x0002;
#[cfg(target_os = "windows")]
const SWP_NOACTIVATE: u32 = 0x0010;