Skip to content

Commit 22cbdf6

Browse files
thewrzclaude
andcommitted
chore: migrate to Rust edition 2024
Bumps `edition = "2024"` and `rust-version = "1.85"` (the edition's MSRV; CI installs stable, so this is satisfied). The migration is mechanical and behavior-preserving: - `cargo fix --edition` idiom fixes: redundant `ref` in match patterns dropped (match ergonomics), `expr` macro fragments pinned to `expr_2021` where the 2024 superset behavior isn't wanted. - rustfmt 2024 style edition reflow (import ordering, short single-line `if`/`else`). - Renamed the `gen` closure binding in the playback test — `gen` is a reserved keyword in edition 2024 (replaces the `r#gen` raw-ident escape cargo fix would otherwise leave behind). - Raising the MSRV to 1.85 unlocked two MSRV-gated clippy suggestions, both applied: `Option::map_or(true, ..)` → `is_none_or` in the decoder, and `let x = match ..; x` → return the match directly in `update()`. The pipewire link/registry paths flagged by the 2024 temporary-scope lint use named `let` bindings, so their drop order is unchanged; a force-enabled `tail_expr_drop_order` build reports no warnings. cargo build/test, clippy (--all-targets --all-features -D warnings), fmt, and deny all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fd205bc commit 22cbdf6

29 files changed

Lines changed: 55 additions & 65 deletions

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "honkhonk"
33
version = "0.1.0"
4-
edition = "2021"
5-
rust-version = "1.80"
4+
edition = "2024"
5+
rust-version = "1.85"
66
license = "MIT"
77
description = "Wayland-native Linux soundboard"
88
repository = "https://github.com/thewrz/HonkHonk"

benches/grid_render.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
77
mod support;
88

9-
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
9+
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
1010

1111
use support::{
12-
init_wgpu, make_sounds, render_tiny_skia, self_check, sound_refs, try_render_wgpu, GridFixture,
12+
GridFixture, init_wgpu, make_sounds, render_tiny_skia, self_check, sound_refs, try_render_wgpu,
1313
};
1414

1515
/// Tile counts ADR-009 anchors the baseline against.

benches/support/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use iced_runtime::user_interface::{Cache, UserInterface};
2121

2222
use honkhonk::app::Message;
2323
use honkhonk::state::{AudioFormat, SlotMap, SoundEntry, SoundMetaStore};
24-
use honkhonk::ui::sound_grid::{view_grid, GridCtx};
24+
use honkhonk::ui::sound_grid::{GridCtx, view_grid};
2525

2626
const CATEGORIES: &[&str] = &["Honk", "Memes", "Reactions", "Voicelines", "Music", "SFX"];
2727

src/app/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn shortcuts_stream_sub(
224224
use iced::futures::SinkExt;
225225
use iced::futures::StreamExt;
226226
iced::stream::channel(16, async move |mut tx| {
227-
use crate::shortcuts::{portal, ShortcutEvent};
227+
use crate::shortcuts::{ShortcutEvent, portal};
228228
let stream = portal::shortcut_stream(window_id);
229229
let mut stream = std::pin::pin!(stream);
230230
while let Some(ev) = stream.next().await {
@@ -549,7 +549,7 @@ impl HonkHonk {
549549
}
550550

551551
pub fn update(&mut self, message: Message) -> Task<Message> {
552-
let task = match message {
552+
match message {
553553
Message::ToggleVisibility => {
554554
self.visible = !self.visible;
555555
Task::none()
@@ -1149,8 +1149,7 @@ impl HonkHonk {
11491149
mode,
11501150
},
11511151
),
1152-
};
1153-
task
1152+
}
11541153
}
11551154

11561155
/// Process every audio event queued since the last poll tick.
@@ -1470,7 +1469,7 @@ impl HonkHonk {
14701469
));
14711470

14721471
// Overlay context menu at window level so cursor coords map exactly.
1473-
if let (Some(ref sound_id), Some(pos)) = (&self.context_menu, self.context_menu_pos) {
1472+
if let (Some(sound_id), Some(pos)) = (&self.context_menu, self.context_menu_pos) {
14741473
let found = self.sounds.iter().find(|s| s.id == *sound_id);
14751474
layers.push(sound_grid::context_menu_overlay(
14761475
found,

src/app/playback.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ mod tests {
223223
channels: 1,
224224
duration: std::time::Duration::from_millis(100),
225225
};
226-
let dispatch = |gen: u64| PlaybackDispatch {
227-
generation: gen,
228-
voice_id: gen,
226+
let dispatch = |generation: u64| PlaybackDispatch {
227+
generation,
228+
voice_id: generation,
229229
gain: 1.0,
230230
effects,
231231
mode: PlayMode::Concurrent,

src/audio/decoder.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ fn decode_packets(
116116
channels.get_or_insert(spec.channels.count() as u16);
117117
let capacity = decoded.capacity();
118118

119-
if sample_buf
120-
.as_ref()
121-
.map_or(true, |b| capacity > b.capacity())
122-
{
119+
if sample_buf.as_ref().is_none_or(|b| capacity > b.capacity()) {
123120
sample_buf = Some(SampleBuffer::<f32>::new(capacity as u64, spec));
124121
}
125122
let buf = sample_buf.as_mut().expect("buffer just initialized");

src/audio/effects/formant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
//! allocation, locking, or syscalls. [`AudioEffect::process`] feeds samples one
2121
//! at a time through the node's `tick`, which is allocation-free.
2222
23-
use super::formant_dsp::{estimate_envelope, read_polar, recombine, Ratios, BINS, ENV_EPS, WINDOW};
24-
use super::formant_preset::FormantPreset;
2523
use super::AudioEffect;
24+
use super::formant_dsp::{BINS, ENV_EPS, Ratios, WINDOW, estimate_envelope, read_polar, recombine};
25+
use super::formant_preset::FormantPreset;
2626
use crate::audio::error::EffectsError;
2727
// `Complex32` is re-exported through `fundsp::prelude32::*` (via `fundsp::math`,
2828
// which `pub use num_complex::Complex32`), so no direct `num_complex` dependency

src/audio/effects/formant_dsp.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,7 @@ pub(crate) mod test_signal {
146146
num += f * mag;
147147
den += mag;
148148
}
149-
if den > 0.0 {
150-
num / den
151-
} else {
152-
0.0
153-
}
149+
if den > 0.0 { num / den } else { 0.0 }
154150
}
155151

156152
/// A two-formant synthetic "vowel": a buzz fundamental with energy

src/audio/effects/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub use filter::BandpassFilterEffect;
2121
pub use flanger::Flanger;
2222
pub use formant::FormantPitchEffect;
2323
pub use formant_preset::FormantPreset;
24-
pub use layout::{default_chain, EffectSlot};
24+
pub use layout::{EffectSlot, default_chain};
2525
pub use modulation::RingModEffect;
2626
pub use pitch::PitchShiftEffect;
2727
pub use preset::PitchPreset;

src/audio/effects/pitch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
//! Before the first full block is ready the FIFO underflows and we emit silence —
1919
//! this is the algorithmic latency reported by [`AudioEffect::latency_samples`].
2020
21-
use super::preset::PitchPreset;
2221
use super::AudioEffect;
22+
use super::preset::PitchPreset;
2323
use crate::audio::error::EffectsError;
2424
use pitch_shift::{Shifter, TOTAL_F32};
2525

0 commit comments

Comments
 (0)