From 7c577eafd78a10f66d0c77b4fc0027145b4bd260 Mon Sep 17 00:00:00 2001 From: lashman Date: Mon, 21 Sep 2026 01:18:07 +0300 Subject: [PATCH] use let-else where the match only guarded an exit --- src-tauri/build.rs | 5 ++--- src-tauri/src/encode.rs | 10 +++------- src-tauri/src/lib.rs | 10 ++++------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src-tauri/build.rs b/src-tauri/build.rs index c645bbe..e5e270e 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -75,9 +75,8 @@ fn find_fxc() -> Option { // Pick the highest-versioned SDK with an x64 fxc.exe. let mut best: Option<(String, PathBuf)> = None; for entry in entries.flatten() { - let name = match entry.file_name().into_string() { - Ok(s) => s, - Err(_) => continue, + let Ok(name) = entry.file_name().into_string() else { + continue; }; // Skip non-version dirs (arm64, x64, x86 at the root level). if !name.starts_with("10.") { diff --git a/src-tauri/src/encode.rs b/src-tauri/src/encode.rs index da5bb2d..1454a16 100644 --- a/src-tauri/src/encode.rs +++ b/src-tauri/src/encode.rs @@ -300,9 +300,8 @@ impl CodecAvailability { } pub(crate) fn codec_availability(ffmpeg: &Path) -> CodecAvailability { - let encoders = match list_encoders(ffmpeg) { - Ok(set) => set, - Err(_) => return CodecAvailability::all_unknown(), + let Ok(encoders) = list_encoders(ffmpeg) else { + return CodecAvailability::all_unknown(); }; CodecAvailability { h264: encoders.contains(mp4_video_codec(Mp4Codec::H264)), @@ -442,10 +441,7 @@ fn two_pass_video( } fn cleanup_pass_logs(stem: &Path) { - let parent = match stem.parent() { - Some(p) => p, - None => return, - }; + let Some(parent) = stem.parent() else { return }; let prefix = stem.file_name().and_then(OsStr::to_str).unwrap_or(""); if prefix.is_empty() { return; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 37db735..2ceaa78 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1161,9 +1161,8 @@ const OVERLAY_TITLEBAR_LOGICAL_PX: f64 = 24.0; /// Remove temporary recording artifacts (segments, previews, thumbs). /// Called on app exit so a discarded clip doesn't linger in `temp/`. fn cleanup_temp_on_exit(app: &AppHandle) { - let st = match app.try_state::() { - Some(s) => s, - None => return, + let Some(st) = app.try_state::() else { + return; }; clear_temp_segments(&st.app_dir, false); } @@ -1196,9 +1195,8 @@ fn start_overlay_clickthrough_poll( } } - let overlay = match app.get_webview_window("overlay") { - Some(w) => w, - None => continue, + let Some(overlay) = app.get_webview_window("overlay") else { + continue; }; if !overlay.is_visible().unwrap_or(false) { last_inner = None;