diff --git a/src-tauri/src/audio.rs b/src-tauri/src/audio.rs index 255b907..7a9a0c4 100644 --- a/src-tauri/src/audio.rs +++ b/src-tauri/src/audio.rs @@ -133,6 +133,14 @@ fn parse_format(fmt: &WAVEFORMATEX) -> Result<(u32, u16, u16, bool)> { Ok((n_samples_per_sec, n_channels, w_bits_per_sample, is_float)) } +// Owns the thread's handles for its whole life: `running` is the stop flag, the +// sender hands the init result back, and output_path is where the PCM lands. +// Passing any of them by reference would just move the same ownership into the +// closure that spawns this. +#[allow( + clippy::needless_pass_by_value, + reason = "the spawned thread owns all three values for its entire lifetime" +)] fn capture_thread( running: Arc, output_path: PathBuf, diff --git a/src-tauri/src/encode.rs b/src-tauri/src/encode.rs index fde6484..cea5610 100644 --- a/src-tauri/src/encode.rs +++ b/src-tauri/src/encode.rs @@ -1184,6 +1184,12 @@ fn ffmpeg_failure_message(label: &str, status: std::process::ExitStatus, stderr: } } +// Consumes the progress sender and the cancel flag: both are moved into the +// reader threads this spawns, so borrowing them here would not typecheck. +#[allow( + clippy::needless_pass_by_value, + reason = "progress_tx and cancel are moved into the threads spawned below" +)] fn run_impl( cmd: &mut Command, label: &str, diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 5e525c3..852b16a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,3 +1,12 @@ +// Tauri deserializes every #[tauri::command] argument from the JS call and hands +// it over by value - State<'_, T>, AppHandle, String, the request structs. +// Taking them by reference would break the generated command wrapper, so the +// by-value signatures below are required rather than incidental. +#![allow( + clippy::needless_pass_by_value, + reason = "tauri::command arguments are passed by value by the generated wrapper" +)] + mod audio; mod bootstrap; mod capture;