From e27c497df84eab6de97184914e61283abc4ce3bb Mon Sep 17 00:00:00 2001 From: Breadway Date: Thu, 6 Aug 2026 08:51:24 +0800 Subject: [PATCH] clippy: fix dead-code and question-mark warnings - meta.rs/tour.rs/troubleshoot.rs: annotate content-schema fields that real TOML content already populates but no UI reads yet, instead of dropping them - hyprland.rs: drop Monitor's x/y/width/height, genuinely unused anywhere and not part of any authored content schema - tour/mod.rs: collapse a let-else into ? in the Option-returning on_tour_event closure (cherry picked from commit 4497eca4661112f808d33ef477265d39e0e0a601) --- src/content/meta.rs | 9 +++++++++ src/content/tour.rs | 4 ++++ src/content/troubleshoot.rs | 5 +++++ src/services/hyprland.rs | 4 ---- src/ui/tour/mod.rs | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/content/meta.rs b/src/content/meta.rs index 905ce02..364ca0a 100644 --- a/src/content/meta.rs +++ b/src/content/meta.rs @@ -12,14 +12,23 @@ pub enum Difficulty { #[derive(serde::Deserialize, Clone, Default)] pub struct GuideMeta { pub title: String, + /// Not read by any UI yet — reserved for a future difficulty badge. + /// Real content already sets it, so kept rather than dropped. + #[allow(dead_code)] #[serde(default)] pub difficulty: Difficulty, #[serde(default)] pub tags: Vec, /// Guide dir-names in the same or another category. Unresolvable entries /// are silently dropped when rendering "related guides" — never a crash. + /// Not read by any UI yet — the "related guides" render path doesn't + /// exist. Real content already sets it, so kept rather than dropped. + #[allow(dead_code)] #[serde(default)] pub related: Vec, + /// Not read by any UI yet — reserved for a future "N min read" hint. + /// Real content already sets it, so kept rather than dropped. + #[allow(dead_code)] #[serde(default)] pub estimated_minutes: u32, /// Overrides the parent directory name as the guide's category, if set. diff --git a/src/content/tour.rs b/src/content/tour.rs index 9bda162..6bee9af 100644 --- a/src/content/tour.rs +++ b/src/content/tour.rs @@ -29,6 +29,10 @@ pub enum Success { #[derive(serde::Deserialize, Clone)] pub struct Step { + /// Not read by any Rust code yet — steps are matched by index, not id. + /// Real tour content already sets it (content authors use it to keep + /// track of steps), so kept rather than dropped. + #[allow(dead_code)] pub id: String, pub title: String, pub body: String, diff --git a/src/content/troubleshoot.rs b/src/content/troubleshoot.rs index 7a39da4..948826e 100644 --- a/src/content/troubleshoot.rs +++ b/src/content/troubleshoot.rs @@ -15,6 +15,11 @@ pub struct SymptomOption { pub struct Fix { pub description: String, pub command: String, + /// Not read by `ui::troubleshoot_wizard` yet — the "Run fix" button + /// currently executes unconditionally regardless of this flag. Real + /// symptom content already sets it, so kept rather than dropped; the + /// wizard should gate on it before this is treated as safe. + #[allow(dead_code)] #[serde(default)] pub requires_confirm: bool, } diff --git a/src/services/hyprland.rs b/src/services/hyprland.rs index 4e570fc..ab3bd3e 100644 --- a/src/services/hyprland.rs +++ b/src/services/hyprland.rs @@ -28,10 +28,6 @@ pub struct Client { pub struct Monitor { pub id: i32, pub name: String, - pub x: i32, - pub y: i32, - pub width: i32, - pub height: i32, pub focused: bool, } diff --git a/src/ui/tour/mod.rs b/src/ui/tour/mod.rs index 8112a9d..7404e81 100644 --- a/src/ui/tour/mod.rs +++ b/src/ui/tour/mod.rs @@ -110,7 +110,7 @@ pub fn self_heal() { pub fn on_tour_event(id: &str) { let hit = STATE.with(|cell| { let mut borrow = cell.borrow_mut(); - let Some(state) = borrow.as_mut() else { return None }; + let state = borrow.as_mut()?; // Only a *visibly* confirmed step blocks a re-fire. `confirmed` gets // set below, before `render_step` runs, so that render actually // paints the "done" state instead of the stale pre-confirmation one