finish the lint pass: allow what is contractual, fix what is not
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
clippy::needless_pass_by_value,
|
||||
reason = "tauri::command arguments are passed by value by the generated wrapper"
|
||||
)]
|
||||
// The remaining `exit` hit is inside tauri::generate_context! itself, so it can
|
||||
// only be silenced at crate scope; app.exit in this code is deliberate (see
|
||||
// apply_update).
|
||||
#![allow(
|
||||
clippy::exit,
|
||||
reason = "bounded by the tauri macro expansion, which exits on its own terms"
|
||||
)]
|
||||
|
||||
mod audio;
|
||||
mod bootstrap;
|
||||
@@ -276,6 +283,12 @@ async fn download_update(
|
||||
.map_err(|e| format!("{e:#}"))
|
||||
}
|
||||
|
||||
// Tauri's app.exit is how this process is meant to hand over to the apply
|
||||
// script; the updater cannot replace a running exe, so exiting is the point.
|
||||
#[allow(
|
||||
clippy::exit,
|
||||
reason = "app.exit is the intended way to let the update script replace the running exe"
|
||||
)]
|
||||
#[tauri::command]
|
||||
fn apply_update(app: AppHandle, state: State<'_, AppState>) -> Result<(), String> {
|
||||
use std::os::windows::process::CommandExt;
|
||||
@@ -735,6 +748,13 @@ fn restart_audio_capture(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Finalising a recording is one transaction: stop the live sessions, fix each
|
||||
// segment's timestamps, concatenate, pad and mux the audio, and hand back the
|
||||
// clip. The steps share `ss` and the temp paths throughout.
|
||||
#[allow(
|
||||
clippy::too_many_lines,
|
||||
reason = "one recording-finalisation transaction; the steps share session state and temp paths"
|
||||
)]
|
||||
#[tauri::command]
|
||||
fn stop_capture(app: AppHandle, state: State<'_, AppState>) -> Result<RecordedClip, String> {
|
||||
set_overlay_clickthrough(&app, false);
|
||||
@@ -1527,6 +1547,12 @@ fn open_window_picker(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
/// Tauri deserializes the return into a JS Result, so the wrapper stays even
|
||||
/// though there is no failure path.
|
||||
#[allow(
|
||||
clippy::unnecessary_wraps,
|
||||
reason = "Result is part of the tauri::command contract the frontend invokes"
|
||||
)]
|
||||
fn close_window_picker(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
@@ -1863,6 +1889,12 @@ fn cancel_export(state: State<'_, AppState>) {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
/// Tauri deserializes the return into a JS Result, so the wrapper stays even
|
||||
/// though there is no failure path.
|
||||
#[allow(
|
||||
clippy::unnecessary_wraps,
|
||||
reason = "Result is part of the tauri::command contract the frontend invokes"
|
||||
)]
|
||||
fn codec_availability(state: State<'_, AppState>) -> Result<encode::CodecAvailability, String> {
|
||||
let ffmpeg = bootstrap::ffmpeg_path(&state.app_dir);
|
||||
if !ffmpeg.is_file() {
|
||||
@@ -1871,6 +1903,13 @@ fn codec_availability(state: State<'_, AppState>) -> Result<encode::CodecAvailab
|
||||
Ok(encode::codec_availability(&ffmpeg))
|
||||
}
|
||||
|
||||
// One export is one transaction: resolve the output path, translate the trim
|
||||
// and crop into encoder terms, run the encode, and report the size. Splitting
|
||||
// it would mean threading the same resolved state through the pieces.
|
||||
#[allow(
|
||||
clippy::too_many_lines,
|
||||
reason = "one export transaction; the request translation feeds directly into the encode call"
|
||||
)]
|
||||
#[tauri::command]
|
||||
async fn export(app: AppHandle, state: State<'_, AppState>, request: ExportRequest) -> Result<ExportResult, String> {
|
||||
let (cfg, clip, app_dir, export_cancel) = {
|
||||
@@ -2006,10 +2045,22 @@ async fn export(app: AppHandle, state: State<'_, AppState>, request: ExportReque
|
||||
|
||||
// Process startup: if the exe directory cannot be resolved or config.toml
|
||||
// cannot be created there, there is no degraded mode worth continuing into.
|
||||
/// Start the app: resolve the portable directory, sweep temp/, wire up logging
|
||||
/// and the hotkeys, then hand control to Tauri's event loop.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the executable's own directory cannot be resolved or if
|
||||
/// `config.toml` cannot be created there. Both are fatal for a portable build:
|
||||
/// there is nowhere to write config, logs or temp files.
|
||||
#[allow(
|
||||
clippy::expect_used,
|
||||
reason = "fatal startup conditions with no sensible recovery"
|
||||
)]
|
||||
#[allow(
|
||||
clippy::too_many_lines,
|
||||
reason = "app wiring: logging, state, plugins, hotkeys, updater, then the event loop - one sequence"
|
||||
)]
|
||||
pub fn run() {
|
||||
let app_dir = exe_dir().expect("resolve exe directory");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user