From 239a95a5dff503c26b9d37d967a87ef44505fcc1 Mon Sep 17 00:00:00 2001 From: Jeramie Date: Sun, 14 Jun 2026 05:47:05 -0700 Subject: [PATCH] fix: avoid collapsible_match clippy lint in native-check timer handler clippy 1.96 flags the WM_TIMER arm body (a lone `if`) as collapsible into the match guard. Bind the check_native_toggle result first instead of taking clippy's suggestion to inline the call into the guard - that call mutates state and can write settings to disk, which must not live in a pattern guard. --- src/winapi_thread/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/winapi_thread/mod.rs b/src/winapi_thread/mod.rs index 03edd8f..e42b6f4 100644 --- a/src/winapi_thread/mod.rs +++ b/src/winapi_thread/mod.rs @@ -162,8 +162,11 @@ fn run_message_loop(state: SharedState) { } WM_TIMER if msg.wParam.0 == TIMER_NATIVE_CHECK => { // If a native icon toggle or external taskbar change was detected, - // the internal state moved — refresh the tooltip to match. - if check_native_toggle(&state) { + // the internal state moved — refresh the tooltip to match. Bind the + // result first so this side-effecting check (it can save settings to + // disk) is not lifted into the match guard. + let state_changed = check_native_toggle(&state); + if state_changed { update_tray_tooltip(hwnd, &state); } }