From 3b94f656002aac4cfba2433ed8cd1c90920c719f Mon Sep 17 00:00:00 2001 From: Mason Rhodes Date: Tue, 13 Oct 2026 06:31:15 +0000 Subject: [PATCH] clippy: late-init temp file and async_trait must_use on a newer toolchain CI's clippy (rustc 1.99) rejects two things on main: the script runner's `_colors_file` was declared and assigned later in each branch (needless_late_init), and async_trait's expansion of ThemeModule puts a bare `#[must_use]` on every async method (double_must_use), which is the macro's doing and is allowed on the trait with a note. Main's ci job had been red on these since 0.3.1. --- lmtt-modules/src/custom.rs | 10 ++++------ lmtt-modules/src/lib.rs | 3 +++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lmtt-modules/src/custom.rs b/lmtt-modules/src/custom.rs index 7878060..c4d8b63 100644 --- a/lmtt-modules/src/custom.rs +++ b/lmtt-modules/src/custom.rs @@ -390,15 +390,13 @@ impl CustomModule { cmd.arg(&mode).kill_on_drop(true); // Keep any temp file alive until the script has finished - let _colors_file: Option; - - if script.pass_as_env { + let _colors_file: Option = if script.pass_as_env { for (key, value) in &scheme.colors { let env_key = format!("LMTT_{}", key.to_uppercase()); cmd.env(env_key, value); } cmd.env("LMTT_MODE", &mode); - _colors_file = None; + None } else { let colors_json = serde_json::to_string(&scheme.colors) .map_err(|e| lmtt_core::Error::Module(format!("JSON error: {}", e)))?; @@ -412,8 +410,8 @@ impl CustomModule { .map_err(|e| lmtt_core::Error::Module(format!("Temp file error: {}", e)))?; tokio::fs::write(file.path(), colors_json).await?; cmd.arg(file.path()); - _colors_file = Some(file); - } + Some(file) + }; let output = tokio::time::timeout(clamp_timeout(script.timeout), cmd.output()) .await diff --git a/lmtt-modules/src/lib.rs b/lmtt-modules/src/lib.rs index 0afee42..cf1dcb0 100644 --- a/lmtt-modules/src/lib.rs +++ b/lmtt-modules/src/lib.rs @@ -163,6 +163,9 @@ pub struct ConfigFileInfo { } /// Standard trait that all theme modules must implement +// async_trait's expansion puts a bare `#[must_use]` on every async method, +// which clippy (1.99+) flags as `double_must_use`; it is the macro's doing. +#[allow(clippy::double_must_use)] #[async_trait] pub trait ThemeModule: Send + Sync { /// Module name (e.g., "Waybar", "Hyprland")