use let-else where the match only guarded an exit

This commit is contained in:
2026-09-21 01:18:07 +03:00
parent 72f24b7369
commit 7c577eafd7
3 changed files with 9 additions and 16 deletions
+2 -3
View File
@@ -75,9 +75,8 @@ fn find_fxc() -> Option<PathBuf> {
// Pick the highest-versioned SDK with an x64 fxc.exe. // Pick the highest-versioned SDK with an x64 fxc.exe.
let mut best: Option<(String, PathBuf)> = None; let mut best: Option<(String, PathBuf)> = None;
for entry in entries.flatten() { for entry in entries.flatten() {
let name = match entry.file_name().into_string() { let Ok(name) = entry.file_name().into_string() else {
Ok(s) => s, continue;
Err(_) => continue,
}; };
// Skip non-version dirs (arm64, x64, x86 at the root level). // Skip non-version dirs (arm64, x64, x86 at the root level).
if !name.starts_with("10.") { if !name.starts_with("10.") {
+3 -7
View File
@@ -300,9 +300,8 @@ impl CodecAvailability {
} }
pub(crate) fn codec_availability(ffmpeg: &Path) -> CodecAvailability { pub(crate) fn codec_availability(ffmpeg: &Path) -> CodecAvailability {
let encoders = match list_encoders(ffmpeg) { let Ok(encoders) = list_encoders(ffmpeg) else {
Ok(set) => set, return CodecAvailability::all_unknown();
Err(_) => return CodecAvailability::all_unknown(),
}; };
CodecAvailability { CodecAvailability {
h264: encoders.contains(mp4_video_codec(Mp4Codec::H264)), h264: encoders.contains(mp4_video_codec(Mp4Codec::H264)),
@@ -442,10 +441,7 @@ fn two_pass_video(
} }
fn cleanup_pass_logs(stem: &Path) { fn cleanup_pass_logs(stem: &Path) {
let parent = match stem.parent() { let Some(parent) = stem.parent() else { return };
Some(p) => p,
None => return,
};
let prefix = stem.file_name().and_then(OsStr::to_str).unwrap_or(""); let prefix = stem.file_name().and_then(OsStr::to_str).unwrap_or("");
if prefix.is_empty() { if prefix.is_empty() {
return; return;
+4 -6
View File
@@ -1161,9 +1161,8 @@ const OVERLAY_TITLEBAR_LOGICAL_PX: f64 = 24.0;
/// Remove temporary recording artifacts (segments, previews, thumbs). /// Remove temporary recording artifacts (segments, previews, thumbs).
/// Called on app exit so a discarded clip doesn't linger in `temp/`. /// Called on app exit so a discarded clip doesn't linger in `temp/`.
fn cleanup_temp_on_exit(app: &AppHandle) { fn cleanup_temp_on_exit(app: &AppHandle) {
let st = match app.try_state::<AppState>() { let Some(st) = app.try_state::<AppState>() else {
Some(s) => s, return;
None => return,
}; };
clear_temp_segments(&st.app_dir, false); clear_temp_segments(&st.app_dir, false);
} }
@@ -1196,9 +1195,8 @@ fn start_overlay_clickthrough_poll(
} }
} }
let overlay = match app.get_webview_window("overlay") { let Some(overlay) = app.get_webview_window("overlay") else {
Some(w) => w, continue;
None => continue,
}; };
if !overlay.is_visible().unwrap_or(false) { if !overlay.is_visible().unwrap_or(false) {
last_inner = None; last_inner = None;