take command arguments by value on purpose
This commit is contained in:
@@ -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))
|
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(
|
fn capture_thread(
|
||||||
running: Arc<AtomicBool>,
|
running: Arc<AtomicBool>,
|
||||||
output_path: PathBuf,
|
output_path: PathBuf,
|
||||||
|
|||||||
@@ -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(
|
fn run_impl(
|
||||||
cmd: &mut Command,
|
cmd: &mut Command,
|
||||||
label: &str,
|
label: &str,
|
||||||
|
|||||||
@@ -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 audio;
|
||||||
mod bootstrap;
|
mod bootstrap;
|
||||||
mod capture;
|
mod capture;
|
||||||
|
|||||||
Reference in New Issue
Block a user