From 21d80fde565b5de94a74a207d78f85e761c68042 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Sun, 22 Feb 2026 10:50:21 +0400 Subject: [PATCH] chore: linting --- src-tauri/Cargo.toml | 1 - src-tauri/src/bin/donut_daemon.rs | 27 ++++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2d5c7c8..0f4fb24 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -127,7 +127,6 @@ objc2-app-kit = { version = "0.3.2", features = ["NSWindow", "NSApplication", "N winreg = "0.55" windows = { version = "0.62", features = [ "Win32_Foundation", - "Win32_System_Console", "Win32_System_ProcessStatus", "Win32_System_Threading", "Win32_System_Diagnostics_Debug", diff --git a/src-tauri/src/bin/donut_daemon.rs b/src-tauri/src/bin/donut_daemon.rs index d1be669..a3d1267 100644 --- a/src-tauri/src/bin/donut_daemon.rs +++ b/src-tauri/src/bin/donut_daemon.rs @@ -190,21 +190,22 @@ fn run_daemon() { } #[cfg(windows)] - unsafe { - use windows::Win32::System::Console::{SetConsoleCtrlHandler, PHANDLER_ROUTINE}; - - unsafe extern "system" fn ctrl_handler(_ctrl_type: u32) -> windows::Win32::Foundation::BOOL { - SHOULD_QUIT.store(true, std::sync::atomic::Ordering::SeqCst); - windows::Win32::Foundation::TRUE + { + extern "system" { + fn SetConsoleCtrlHandler( + handler: Option i32>, + add: i32, + ) -> i32; } - let _ = SetConsoleCtrlHandler( - Some(std::mem::transmute::< - unsafe extern "system" fn(u32) -> windows::Win32::Foundation::BOOL, - PHANDLER_ROUTINE, - >(ctrl_handler)), - true, - ); + unsafe extern "system" fn ctrl_handler(_ctrl_type: u32) -> i32 { + SHOULD_QUIT.store(true, std::sync::atomic::Ordering::SeqCst); + 1 // TRUE + } + + unsafe { + SetConsoleCtrlHandler(Some(ctrl_handler), 1); + } } // Run the event loop