Skip to content

Commit fa3bc61

Browse files
authored
chore: enforce configured clippy thresholds (#180)
1 parent 6525890 commit fa3bc61

15 files changed

Lines changed: 115 additions & 0 deletions

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ license = "MIT"
77
description = "Wayland-native Linux soundboard"
88
repository = "https://github.com/thewrz/HonkHonk"
99

10+
[lints.clippy]
11+
cognitive_complexity = "warn"
12+
too_many_lines = "warn"
13+
1014
[dependencies]
1115
iced = { version = "0.14", features = ["tokio", "tiny-skia", "canvas"] }
1216
# Pure-Rust StatusNotifierItem tray over zbus. Replaces tray-icon/muda/gtk so

src/app/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ Select 'HonkHonk Mic' as your input in Discord/OBS."
360360
}
361361

362362
impl HonkHonk {
363+
#[allow(
364+
clippy::too_many_lines,
365+
reason = "constructor lists every app state field explicitly to avoid hidden defaults during app split"
366+
)]
363367
pub fn new(
364368
mut tray: TrayHandle,
365369
audio: AudioHandle,
@@ -593,6 +597,11 @@ impl HonkHonk {
593597
.collect()
594598
}
595599

600+
#[allow(
601+
clippy::cognitive_complexity,
602+
clippy::too_many_lines,
603+
reason = "legacy Elm update dispatcher is being split under #142; keep message routing visible until then"
604+
)]
596605
pub fn update(&mut self, message: Message) -> Task<Message> {
597606
match message {
598607
Message::ToggleVisibility => {
@@ -1435,6 +1444,10 @@ impl HonkHonk {
14351444
Some(banner.into())
14361445
}
14371446

1447+
#[allow(
1448+
clippy::too_many_lines,
1449+
reason = "legacy root layout preserves Iced widget-state ordering while the app split proceeds under #142"
1450+
)]
14381451
fn view_main(&self) -> Element<'_, Message> {
14391452
let t = self.config.theme;
14401453
let header = self.view_header(t);
@@ -2033,6 +2046,10 @@ mod tests {
20332046
assert_eq!(app.now_playing.display_progress(), 0.0);
20342047
}
20352048

2049+
#[allow(
2050+
clippy::too_many_lines,
2051+
reason = "regression test spells out the same-sound re-press event timeline from #149"
2052+
)]
20362053
#[test]
20372054
fn re_pressing_same_sound_keeps_playhead_alive() {
20382055
// Re-pressing the SAME tile while it is still playing must re-trigger the

src/app/panels.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ impl HonkHonk {
1818
}
1919
}
2020

21+
#[allow(
22+
clippy::cognitive_complexity,
23+
reason = "keeps persisted animation toggle and in-flight flourish cleanup colocated"
24+
)]
2125
pub(super) fn set_panel_animations(&mut self, enabled: bool) -> Task<Message> {
2226
if self.config.panel_animations != enabled {
2327
self.config = AppConfig {

src/app/playback.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ impl HonkHonk {
7878
/// `Ok` caches the PCM and starts playback; an `Err` logs and tears down the
7979
/// optimistic state so it does not stick (#151). The `Decoded` arm in
8080
/// `update` delegates straight here.
81+
#[allow(
82+
clippy::cognitive_complexity,
83+
reason = "decode landing owns stale-generation, cache, playback, and UI cleanup invariants"
84+
)]
8185
pub(super) fn handle_decoded(
8286
&mut self,
8387
id: String,

src/audio/engine.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ fn spawn_stream_watcher(
364364
Ok((stream_watcher, stream_rx))
365365
}
366366

367+
#[allow(
368+
clippy::too_many_lines,
369+
reason = "PipeWire mainloop setup keeps Rc handles and guards alive for the engine lifetime"
370+
)]
367371
fn run_engine(
368372
cmd_rx: pipewire::channel::Receiver<AudioCommand>,
369373
evt_tx: mpsc::Sender<AudioEvent>,
@@ -648,6 +652,10 @@ struct PlayRequest {
648652
mode: PlayMode,
649653
}
650654

655+
#[allow(
656+
clippy::too_many_lines,
657+
reason = "play request lifecycle keeps error, stream, voice, and event ordering invariants together"
658+
)]
651659
fn handle_play(ctx: &EngineCtx, req: PlayRequest) {
652660
let PlayRequest {
653661
voice_id,

src/audio/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ mod effects_error_tests {
205205
mod engine_error_event_tests {
206206
use super::*;
207207

208+
#[allow(
209+
clippy::too_many_lines,
210+
reason = "display regression enumerates every public EngineErrorEvent variant"
211+
)]
208212
#[test]
209213
fn engine_error_event_display_preserves_existing_log_text() {
210214
let cases = [

src/audio/registry.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ struct RegistryState {
2828
source_ports: HashMap<u32, Vec<u32>>,
2929
}
3030

31+
#[allow(
32+
clippy::cognitive_complexity,
33+
reason = "PipeWire mic link creation keeps node guards, duplicate suppression, and error logging together"
34+
)]
3135
fn try_create_mic_links(
3236
state: &mut RegistryState,
3337
core: &pipewire::core::Core,
@@ -69,6 +73,10 @@ fn try_create_mic_links(
6973
}
7074
}
7175

76+
#[allow(
77+
clippy::cognitive_complexity,
78+
reason = "PipeWire monitor link creation keeps node guards, duplicate suppression, and error logging together"
79+
)]
7280
fn try_create_monitor_links(
7381
state: &mut RegistryState,
7482
core: &pipewire::core::Core,
@@ -168,6 +176,11 @@ enum DeviceChange {
168176
Inputs,
169177
}
170178

179+
#[allow(
180+
clippy::cognitive_complexity,
181+
clippy::too_many_lines,
182+
reason = "registry callback keeps PipeWire object classification and device-change reporting together"
183+
)]
171184
fn handle_registry_global(
172185
global: &pipewire::registry::GlobalObject<&pipewire::spa::utils::dict::DictRef>,
173186
state: &mut RegistryState,
@@ -337,6 +350,10 @@ pub struct RegistryConfig {
337350
pub shared_sink_ports: Rc<RefCell<Vec<u32>>>,
338351
}
339352

353+
#[allow(
354+
clippy::too_many_lines,
355+
reason = "PipeWire listener owns captured Rc guard setup that must stay in one lifetime scope"
356+
)]
340357
pub fn setup_registry_listener(
341358
core: &pipewire::core::CoreRc,
342359
cfg: RegistryConfig,

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ fn effective_renderer(env_val: Option<&str>, config_pref: Renderer) -> Renderer
88
}
99
}
1010

11+
#[allow(
12+
clippy::cognitive_complexity,
13+
clippy::too_many_lines,
14+
reason = "startup sequence keeps renderer env setup before subsystem initialization"
15+
)]
1116
fn main() -> iced::Result {
1217
honkhonk::logging::init();
1318

src/shortcuts/config_ui.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ impl ShortcutConfigService {
6868
|| matches!(self.desktop_env, DesktopEnv::Kde | DesktopEnv::Gnome)
6969
}
7070

71+
#[allow(
72+
clippy::cognitive_complexity,
73+
reason = "portal-first shortcut configuration keeps desktop fallback behavior in one ladder"
74+
)]
7175
pub(crate) fn open(&self) {
7276
if self.portal_v2_available {
7377
if let Some(tx) = &self.portal_cmd_tx {

src/shortcuts/portal.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ fn make_request_path(conn: &zbus::Connection, suffix: &str) -> zbus::Result<Owne
5050
/// setter, and Session constructors are also pub(crate). We call CreateSession
5151
/// directly via raw zbus to inject SESSION_TOKEN, then return the session path
5252
/// for use in subsequent bind/configure calls.
53+
#[allow(
54+
clippy::too_many_lines,
55+
reason = "raw zbus portal request keeps subscription, method call, and response parsing ordered"
56+
)]
5357
async fn create_session_fixed_token(
5458
conn: &zbus::Connection,
5559
) -> Result<OwnedObjectPath, ashpd::Error> {
@@ -203,6 +207,10 @@ async fn configure_shortcuts_raw(
203207
/// `ShortcutEvent::Ready` once the portal session is established, then
204208
/// `ShortcutEvent::Activated(idx)` on each trigger press.
205209
/// Yields `ShortcutEvent::Failed(reason)` once on error, then ends.
210+
#[allow(
211+
clippy::too_many_lines,
212+
reason = "portal stream owns command channel setup plus activation/change select loop"
213+
)]
206214
pub fn shortcut_stream(_window_id: Option<WindowIdentifier>) -> impl Stream<Item = ShortcutEvent> {
207215
iced::stream::channel(32, async move |mut tx| {
208216
use ashpd::desktop::global_shortcuts::GlobalShortcuts;

0 commit comments

Comments
 (0)