From 01a92f1edfa90f1aad8cd6553a0ff4191480d00f Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sun, 15 Nov 2026 23:09:15 +0100 Subject: [PATCH] app: clear the clippy warnings and the vendored ones Our crate is warning-free under `cargo clippy --all-targets`. The two vendored crates warned about an unreachable expression and a qualified path; both are silenced at their crate root so a normal build prints nothing. --- app/src/app.rs | 21 ++++++++------------- app/src/daemon.rs | 2 -- app/src/history.rs | 2 +- app/src/screens/review.rs | 21 +++++++++++---------- app/src/screens/settings.rs | 8 ++++---- app/src/settings.rs | 18 ++++-------------- app/vendor/parley_engine/src/lib.rs | 2 ++ app/vendor/wgpu-hal/src/lib.rs | 3 +-- 8 files changed, 31 insertions(+), 46 deletions(-) diff --git a/app/src/app.rs b/app/src/app.rs index e7969c3..957b2f9 100644 --- a/app/src/app.rs +++ b/app/src/app.rs @@ -49,7 +49,7 @@ impl Status { "recording" => "Recording".to_string(), "error" => "Error".to_string(), "shutting_down" => "Shutting down".to_string(), - other if other.is_empty() => "Unknown".to_string(), + "" => "Unknown".to_string(), other => other.to_string(), } } @@ -392,12 +392,10 @@ impl App { self.notify_error(format!("Status did not parse: {e}")); } }, - (ipc::Request::Status, Err(e)) => { - if self.connected { - self.connected = false; - self.notify_error(format!("Lost the record-daemon: {e}")); - self.refresh_games(); - } + (ipc::Request::Status, Err(e)) if self.connected => { + self.connected = false; + self.notify_error(format!("Lost the record-daemon: {e}")); + self.refresh_games(); } (ipc::Request::Encoders, Ok(data)) => { if let Ok(list) = serde_json::from_value(data) { @@ -451,11 +449,8 @@ impl App { let mut tray_events = Vec::new(); if let Some(rx) = &self.tray_events { - loop { - match rx.try_recv() { - Ok(event) => tray_events.push(event), - Err(_) => break, - } + while let Ok(event) = rx.try_recv() { + tray_events.push(event); } } for event in tray_events { @@ -764,7 +759,7 @@ pub fn demo_review(app: &mut App) { app.screen = Screen::Review; app.review.game = app.games.first().map(|game| game.recording_id.clone()); app.review.error = Some("Sample recording: no clip on disk.".to_string()); - if let Some(game) = app.games.get(0) { + if let Some(game) = app.games.first() { app.review.highlights = crate::highlight::compute(game, game.summoner().as_deref(), Default::default()); app.review.duration = game.duration_secs.max(0) as f64; diff --git a/app/src/daemon.rs b/app/src/daemon.rs index cadb01c..0bc065c 100644 --- a/app/src/daemon.rs +++ b/app/src/daemon.rs @@ -106,8 +106,6 @@ pub fn spawn() -> Result { Ok(binary) } -/// Is a daemon answering on the pipe? - /// Wait up to `timeout` for the daemon to answer, starting it if it isn't running yet. pub async fn ensure_running() -> Result<(), String> { let client = Client::new(); diff --git a/app/src/history.rs b/app/src/history.rs index f71a66d..7c55c6b 100644 --- a/app/src/history.rs +++ b/app/src/history.rs @@ -172,7 +172,7 @@ pub fn load_all() -> Vec { }); let mut out = parsed.into_inner().unwrap(); - out.sort_by(|a, b| b.start_time.cmp(&a.start_time)); + out.sort_by_key(|timeline| std::cmp::Reverse(timeline.start_time)); out } diff --git a/app/src/screens/review.rs b/app/src/screens/review.rs index 012d53f..36b4321 100644 --- a/app/src/screens/review.rs +++ b/app/src/screens/review.rs @@ -100,17 +100,18 @@ pub fn tick(app: &mut App, tx: &mut Tx) -> bool { app.review.time = time; changed = true; } - if let Some(duration) = player.duration() { - if duration > 0.0 && (duration - app.review.duration).abs() > 0.05 { - app.review.duration = duration; - changed = true; - } + if let Some(duration) = player.duration() + && duration > 0.0 + && (duration - app.review.duration).abs() > 0.05 + { + app.review.duration = duration; + changed = true; } - if app.review.error.is_none() { - if let rune::PlayerState::Failed(message) = player.state() { - app.review.error = Some(message); - changed = true; - } + if app.review.error.is_none() + && let rune::PlayerState::Failed(message) = player.state() + { + app.review.error = Some(message); + changed = true; } if player.is_playing() { tx.wake_after(std::time::Duration::from_millis(33)); diff --git a/app/src/screens/settings.rs b/app/src/screens/settings.rs index fbe8a61..d31964e 100644 --- a/app/src/screens/settings.rs +++ b/app/src/screens/settings.rs @@ -73,7 +73,7 @@ impl Form { } /// Pull the text fields into the draft and hand it to `updateSettings`. - pub fn to_settings(&mut self) -> Settings { + pub fn settings(&mut self) -> Settings { let mut out = self.draft.clone(); out.output.path = self.path.text.trim().to_string(); out.output.naming_pattern = self.naming.text.trim().to_string(); @@ -170,7 +170,7 @@ fn text_row( ) } -/// A row with a dropdown on the right. +#[allow(clippy::too_many_arguments)] // the columns of a settings row fn select_row( p: Paint, kit: &rune_kit::Kit, @@ -270,7 +270,7 @@ pub fn view(app: &App, p: Paint) -> El { text(save_label(app)) .key("save-label") .font(body(11.5)) - .color(if app.form.dirty { p.muted() } else { p.muted() }), + .color(p.muted()), ), ) .child(ui::button(p, "revert", "Revert", false, |app: &mut App| { @@ -283,7 +283,7 @@ pub fn view(app: &App, p: Paint) -> El { if !app.form.loaded { return; } - let settings = app.form.to_settings(); + let settings = app.form.settings(); match serde_json::to_value(&settings) { Ok(value) => app.daemon.save_settings(value), Err(e) => { diff --git a/app/src/settings.rs b/app/src/settings.rs index ed8ec46..22fe8bd 100644 --- a/app/src/settings.rs +++ b/app/src/settings.rs @@ -124,35 +124,25 @@ impl EncoderPreset { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(rename_all = "lowercase")] pub enum AmfQuality { Speed, + #[default] Balanced, Quality, } -impl Default for AmfQuality { - fn default() -> Self { - Self::Balanced - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(rename_all = "lowercase")] pub enum Quality { Low, Medium, + #[default] High, Ultra, } -impl Default for Quality { - fn default() -> Self { - Self::High - } -} - impl Quality { pub fn label(self) -> &'static str { match self { diff --git a/app/vendor/parley_engine/src/lib.rs b/app/vendor/parley_engine/src/lib.rs index ea7d79b..8a7be65 100644 --- a/app/vendor/parley_engine/src/lib.rs +++ b/app/vendor/parley_engine/src/lib.rs @@ -100,6 +100,8 @@ #![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))] // END LINEBENDER LINT SET #![cfg_attr(docsrs, feature(doc_cfg))] +// Vendored: the upstream crate has an unreachable expression rustc warns about; keep the build log quiet. +#![allow(unreachable_code)] #![no_std] #[cfg(feature = "std")] extern crate std; diff --git a/app/vendor/wgpu-hal/src/lib.rs b/app/vendor/wgpu-hal/src/lib.rs index ca626f2..34d01f5 100644 --- a/app/vendor/wgpu-hal/src/lib.rs +++ b/app/vendor/wgpu-hal/src/lib.rs @@ -234,8 +234,7 @@ trivial_casts, trivial_numeric_casts, unsafe_op_in_unsafe_fn, - unused_extern_crates, - unused_qualifications + unused_extern_crates )] extern crate alloc;