Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy

Richie McIlroy24d3ad9fbbe1
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index 2ba65ec5f..502fad337 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -3448,37 +3448,37 @@ async fn wait_for_recording_ready(app: &AppHandle, path: &Path) -> Result<(), St
}
};
- if let Some(studio_meta) = meta.studio_meta() {
- if matches!(studio_meta.status(), StudioRecordingStatus::InProgress) {
- info!("Recording/import is in progress, waiting for completion...");
- const POLL_INTERVAL: std::time::Duration = std::time::Duration::from_millis(250);
- const MAX_WAIT: std::time::Duration = std::time::Duration::from_secs(600);
- let start = std::time::Instant::now();
-
- loop {
- if start.elapsed() > MAX_WAIT {
- return Err("Timed out waiting for import to complete".to_string());
- }
+ if let Some(studio_meta) = meta.studio_meta()
+ && matches!(studio_meta.status(), StudioRecordingStatus::InProgress)
+ {
+ info!("Recording/import is in progress, waiting for completion...");
+ const POLL_INTERVAL: std::time::Duration = std::time::Duration::from_millis(250);
+ const MAX_WAIT: std::time::Duration = std::time::Duration::from_secs(600);
+ let start = std::time::Instant::now();
- tokio::time::sleep(POLL_INTERVAL).await;
+ loop {
+ if start.elapsed() > MAX_WAIT {
+ return Err("Timed out waiting for import to complete".to_string());
+ }
- let current_meta = match RecordingMeta::load_for_project(path) {
- Ok(m) => m,
- Err(_) => continue,
- };
+ tokio::time::sleep(POLL_INTERVAL).await;
- if let Some(current_studio) = current_meta.studio_meta() {
- match current_studio.status() {
- StudioRecordingStatus::Complete => {
- info!("Recording/import completed");
- break;
- }
- StudioRecordingStatus::Failed { error } => {
- return Err(format!("Import failed: {error}"));
- }
- StudioRecordingStatus::InProgress => continue,
- StudioRecordingStatus::NeedsRemux => break,
+ let current_meta = match RecordingMeta::load_for_project(path) {
+ Ok(m) => m,
+ Err(_) => continue,
+ };
+
+ if let Some(current_studio) = current_meta.studio_meta() {
+ match current_studio.status() {
+ StudioRecordingStatus::Complete => {
+ info!("Recording/import completed");
+ break;
+ }
+ StudioRecordingStatus::Failed { error } => {
+ return Err(format!("Import failed: {error}"));
}
+ StudioRecordingStatus::InProgress => continue,
+ StudioRecordingStatus::NeedsRemux => break,
}
}
}
diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rs
index 147a39881..12af2a94d 100644
--- a/apps/desktop/src-tauri/src/recording.rs
+++ b/apps/desktop/src-tauri/src/recording.rs
@@ -1818,8 +1818,7 @@ fn generate_zoom_segments_from_clicks_impl(
let click_time = click.time_ms;
moves
.iter()
- .filter(|m| m.time_ms <= click_time)
- .next_back()
+ .rfind(|m| m.time_ms <= click_time)
.map(|m| (idx, (m.x, m.y)))
})
.collect();