return values instead of wrapping them in needless results

This commit is contained in:
2026-09-21 01:26:53 +03:00
parent b2dd93fb09
commit e6e0d5b2b4
4 changed files with 26 additions and 24 deletions
+3 -9
View File
@@ -602,9 +602,7 @@ fn pause_capture(state: State<'_, AppState>) -> Result<(), String> {
.map_err(|e| format!("fixing fps: {e:#}"))?;
let path = if fixed_path.exists() { fixed_path } else { raw_path };
let audio_path = lock(&state.audio)
.take()
.and_then(|a| a.stop().ok());
let audio_path = lock(&state.audio).take().map(|a| a.stop());
let new_clicks: Vec<clicks::Click> = lock(&state.click_recorder)
.take()
@@ -701,9 +699,7 @@ fn restart_audio_capture(
let mut ss = lock(&state.session);
let ss = ss.as_mut().ok_or_else(|| "no session in progress".to_string())?;
if let Some(a) = lock(&state.audio).take() {
if let Ok(p) = a.stop() {
ss.audio_segments.push(p);
}
ss.audio_segments.push(a.stop());
}
ss.audio_segments.len() + 1
};
@@ -747,9 +743,7 @@ fn stop_capture(app: AppHandle, state: State<'_, AppState>) -> Result<RecordedCl
let live_audio = lock(&state.audio).take();
if let Some(a) = live_audio {
if let Ok(p) = a.stop() {
ss.audio_segments.push(p);
}
ss.audio_segments.push(a.stop());
}
let live_clicks = lock(&state.click_recorder)