Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy bits

Richie McIlroye62cccac2773
diff --git a/apps/desktop/src-tauri/src/captions.rs b/apps/desktop/src-tauri/src/captions.rs
index 0dde35418..f4fb8ac49 100644
--- a/apps/desktop/src-tauri/src/captions.rs
+++ b/apps/desktop/src-tauri/src/captions.rs
@@ -61,7 +61,7 @@ pub async fn save_model_file(path: String, data: Vec<u8>) -> Result<(), String>
async fn extract_audio_from_video(video_path: &str, output_path: &PathBuf) -> Result<(), String> {
log::info!("=== EXTRACT AUDIO START ===");
log::info!("Attempting to extract audio from: {video_path}");
- log::info!("Output path: {:?}", output_path);
+ log::info!("Output path: {output_path:?}");
if video_path.ends_with(".cap") {
log::info!("Detected .cap project directory");
@@ -160,12 +160,11 @@ async fn extract_audio_from_video(video_path: &str, output_path: &PathBuf) -> Re
log::info!("Final mixed audio: {} samples", mixed_samples.len());
let mix_rms =
(mixed_samples.iter().map(|&s| s * s).sum::<f32>() / mixed_samples.len() as f32).sqrt();
- log::info!("Mixed audio RMS: {:.4}", mix_rms);
+ log::info!("Mixed audio RMS: {mix_rms:.4}");
if mix_rms < 0.001 {
log::warn!(
- "WARNING: Mixed audio RMS is very low ({:.6}) - audio may be nearly silent!",
- mix_rms
+ "WARNING: Mixed audio RMS is very low ({mix_rms:.6}) - audio may be nearly silent!"
);
}
@@ -509,7 +508,7 @@ fn is_special_token(token_text: &str) -> bool {
|| trimmed.contains("<|");
if is_special {
- log::debug!("Filtering special token: {:?}", token_text);
+ log::debug!("Filtering special token: {token_text:?}");
}
is_special
@@ -522,7 +521,7 @@ fn process_with_whisper(
) -> Result<CaptionData, String> {
log::info!("=== WHISPER TRANSCRIPTION START ===");
log::info!("Processing audio file: {audio_path:?}");
- log::info!("Language setting: {}", language);
+ log::info!("Language setting: {language}");
let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 1 });
@@ -569,18 +568,11 @@ fn process_with_whisper(
/ audio_data_f32.len() as f32)
.sqrt();
log::info!(
- "Audio samples - min: {:.4}, max: {:.4}, avg: {:.6}, RMS: {:.4}",
- min_sample,
- max_sample,
- avg_sample,
- rms
+ "Audio samples - min: {min_sample:.4}, max: {max_sample:.4}, avg: {avg_sample:.6}, RMS: {rms:.4}"
);
if rms < 0.001 {
- log::warn!(
- "WARNING: Audio RMS is very low ({:.6}) - audio may be nearly silent!",
- rms
- );
+ log::warn!("WARNING: Audio RMS is very low ({rms:.6}) - audio may be nearly silent!");
}
log::info!("First 20 audio samples:");
@@ -646,10 +638,7 @@ fn process_with_whisper(
if is_special_token(&token_text) {
log::debug!(
- " Token[{}]: id={}, text={:?} -> SKIPPED (special)",
- t,
- token_id,
- token_text
+ " Token[{t}]: id={token_id}, text={token_text:?} -> SKIPPED (special)"
);
continue;
}
@@ -661,13 +650,7 @@ fn process_with_whisper(
let token_end = (data.t1 as f32) / 100.0;
log::info!(
- " Token[{}]: id={}, text={:?}, t0={:.2}s, t1={:.2}s, prob={:.4}",
- t,
- token_id,
- token_text,
- token_start,
- token_end,
- token_prob
+ " Token[{t}]: id={token_id}, text={token_text:?}, t0={token_start:.2}s, t1={token_end:.2}s, prob={token_prob:.4}"
);
if token_text.starts_with(' ') || token_text.starts_with('\n') {
@@ -688,27 +671,18 @@ fn process_with_whisper(
}
current_word = token_text.trim().to_string();
word_start = Some(token_start);
- log::debug!(
- " -> Starting new word: '{}' at {:.2}s",
- current_word,
- token_start
- );
+ log::debug!(" -> Starting new word: '{current_word}' at {token_start:.2}s");
} else {
if word_start.is_none() {
word_start = Some(token_start);
- log::debug!(" -> Word start set to {:.2}s", token_start);
+ log::debug!(" -> Word start set to {token_start:.2}s");
}
current_word.push_str(&token_text);
- log::debug!(" -> Appending to word: '{}'", current_word);
+ log::debug!(" -> Appending to word: '{current_word}'");
}
word_end = token_end;
} else {
- log::warn!(
- " Token[{}]: id={}, text={:?} -> NO TIMING DATA",
- t,
- token_id,
- token_text
- );
+ log::warn!(" Token[{t}]: id={token_id}, text={token_text:?} -> NO TIMING DATA");
}
}
@@ -740,7 +714,7 @@ fn process_with_whisper(
}
if words.is_empty() {
- log::warn!(" Segment {} has no words, skipping", i);
+ log::warn!(" Segment {i} has no words, skipping");
continue;
}
@@ -778,7 +752,7 @@ fn process_with_whisper(
log::info!("Total segments: {}", segments.len());
let total_words: usize = segments.iter().map(|s| s.words.len()).sum();
- log::info!("Total words: {}", total_words);
+ log::info!("Total words: {total_words}");
log::info!("=== FINAL TRANSCRIPTION SUMMARY ===");
for segment in &segments {
@@ -813,7 +787,7 @@ fn find_python() -> Option<String> {
if version.contains("Python 3")
|| String::from_utf8_lossy(&output.stderr).contains("Python 3")
{
- log::info!("Found Python 3 at: {}", cmd);
+ log::info!("Found Python 3 at: {cmd}");
return Some(cmd.to_string());
}
}
@@ -961,8 +935,8 @@ fn ensure_server_script_exists() -> Result<PathBuf, String> {
if !script_path.exists() {
std::fs::write(&script_path, get_whisperx_server_script())
- .map_err(|e| format!("Failed to write server script: {}", e))?;
- log::info!("Created WhisperX server script at {:?}", script_path);
+ .map_err(|e| format!("Failed to write server script: {e}"))?;
+ log::info!("Created WhisperX server script at {script_path:?}");
}
Ok(script_path)
@@ -978,7 +952,7 @@ fn start_whisperx_server(
let script_path = ensure_server_script_exists()?;
- log::info!("Starting WhisperX server with model size: {}", model_size);
+ log::info!("Starting WhisperX server with model size: {model_size}");
let mut child = Command::new(venv_python)
.arg(&script_path)
@@ -989,7 +963,7 @@ fn start_whisperx_server(
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.spawn()
- .map_err(|e| format!("Failed to start WhisperX server: {}", e))?;
+ .map_err(|e| format!("Failed to start WhisperX server: {e}"))?;
let stdin = child
.stdin
@@ -1012,9 +986,9 @@ fn start_whisperx_server(
let reader = std::io::BufReader::new(stderr);
for line in reader.lines().map_while(Result::ok) {
if let Some(stripped) = line.strip_prefix("STDERR:") {
- log::info!("[WhisperX] {}", stripped);
+ log::info!("[WhisperX] {stripped}");
} else {
- log::info!("[WhisperX stderr] {}", line);
+ log::info!("[WhisperX stderr] {line}");
}
}
});
@@ -1047,7 +1021,7 @@ fn start_whisperx_server(
}
Err(e) => {
let _ = child.kill();
- return Err(format!("Error reading from WhisperX server: {}", e));
+ return Err(format!("Error reading from WhisperX server: {e}"));
}
}
}
@@ -1092,24 +1066,24 @@ fn transcribe_with_server(
server
.stdin
.flush()
- .map_err(|e| format!("Failed to flush request: {}", e))?;
+ .map_err(|e| format!("Failed to flush request: {e}"))?;
let mut response_line = String::new();
server
.stdout
.read_line(&mut response_line)
- .map_err(|e| format!("Failed to read response from server: {}", e))?;
+ .map_err(|e| format!("Failed to read response from server: {e}"))?;
let response: serde_json::Value = serde_json::from_str(&response_line)
- .map_err(|e| format!("Failed to parse server response: {}", e))?;
+ .map_err(|e| format!("Failed to parse server response: {e}"))?;
if !response["success"].as_bool().unwrap_or(false) {
let error = response["error"].as_str().unwrap_or("Unknown error");
- return Err(format!("WhisperX server error: {}", error));
+ return Err(format!("WhisperX server error: {error}"));
}
let whisperx_result: WhisperXOutput = serde_json::from_value(response["result"].clone())
- .map_err(|e| format!("Failed to parse WhisperX output: {}", e))?;
+ .map_err(|e| format!("Failed to parse WhisperX output: {e}"))?;
log::info!(
"WhisperX server produced {} segments",
@@ -1188,7 +1162,7 @@ fn transcribe_with_server(
.unwrap_or(whisperx_seg.end as f32);
segments.push(CaptionSegment {
- id: format!("segment-{}-{}", seg_idx, chunk_idx),
+ id: format!("segment-{seg_idx}-{chunk_idx}"),
start: segment_start,
end: segment_end,
text: segment_text,
@@ -1209,7 +1183,7 @@ fn get_whisperx_cache_dir() -> Result<PathBuf, String> {
.ok_or_else(|| "Could not determine cache directory".to_string())?;
let whisperx_dir = cache_dir.join("cap").join("whisperx");
std::fs::create_dir_all(&whisperx_dir)
- .map_err(|e| format!("Failed to create whisperx cache directory: {}", e))?;
+ .map_err(|e| format!("Failed to create whisperx cache directory: {e}"))?;
Ok(whisperx_dir)
}
@@ -1217,7 +1191,7 @@ fn get_whisperx_models_cache_dir() -> Result<PathBuf, String> {
let cache_dir = get_whisperx_cache_dir()?;
let models_dir = cache_dir.join("models");
std::fs::create_dir_all(&models_dir)
- .map_err(|e| format!("Failed to create whisperx models cache directory: {}", e))?;
+ .map_err(|e| format!("Failed to create whisperx models cache directory: {e}"))?;
Ok(models_dir)
}
@@ -1225,7 +1199,7 @@ fn get_huggingface_cache_dir() -> Result<PathBuf, String> {
let cache_dir = get_whisperx_cache_dir()?;
let hf_dir = cache_dir.join("huggingface");
std::fs::create_dir_all(&hf_dir)
- .map_err(|e| format!("Failed to create huggingface cache directory: {}", e))?;
+ .map_err(|e| format!("Failed to create huggingface cache directory: {e}"))?;
Ok(hf_dir)
}
@@ -1233,7 +1207,7 @@ fn get_torch_cache_dir() -> Result<PathBuf, String> {
let cache_dir = get_whisperx_cache_dir()?;
let torch_dir = cache_dir.join("torch");
std::fs::create_dir_all(&torch_dir)
- .map_err(|e| format!("Failed to create torch cache directory: {}", e))?;
+ .map_err(|e| format!("Failed to create torch cache directory: {e}"))?;
Ok(torch_dir)
}
@@ -1254,24 +1228,20 @@ fn create_venv_if_needed(system_python: &str) -> Result<PathBuf, String> {
let venv_python = get_venv_python()?;
if venv_python.exists() {
- log::info!("Virtual environment already exists at: {:?}", venv_dir);
+ log::info!("Virtual environment already exists at: {venv_dir:?}");
return Ok(venv_python);
}
- log::info!(
- "Creating virtual environment at: {:?} using {}",
- venv_dir,
- system_python
- );
+ log::info!("Creating virtual environment at: {venv_dir:?} using {system_python}");
let output = Command::new(system_python)
.args(["-m", "venv", venv_dir.to_str().unwrap()])
.output()
- .map_err(|e| format!("Failed to create venv: {}", e))?;
+ .map_err(|e| format!("Failed to create venv: {e}"))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
- return Err(format!("Failed to create virtual environment: {}", stderr));
+ return Err(format!("Failed to create virtual environment: {stderr}"));
}
if !venv_python.exists() {
@@ -1286,7 +1256,7 @@ fn create_venv_if_needed(system_python: &str) -> Result<PathBuf, String> {
.output();
if let Err(e) = pip_upgrade {
- log::warn!("Failed to upgrade pip in venv: {}", e);
+ log::warn!("Failed to upgrade pip in venv: {e}");
}
Ok(venv_python)
@@ -1297,11 +1267,11 @@ fn download_whisperx_whl() -> Result<PathBuf, String> {
let whl_path = cache_dir.join(WHISPERX_WHL_NAME);
if whl_path.exists() {
- log::info!("WhisperX wheel already cached at: {:?}", whl_path);
+ log::info!("WhisperX wheel already cached at: {whl_path:?}");
return Ok(whl_path);
}
- log::info!("Downloading WhisperX wheel from: {}", WHISPERX_WHL_URL);
+ log::info!("Downloading WhisperX wheel from: {WHISPERX_WHL_URL}");
let output = Command::new("curl")
.args([
@@ -1312,18 +1282,18 @@ fn download_whisperx_whl() -> Result<PathBuf, String> {
WHISPERX_WHL_URL,
])
.output()
- .map_err(|e| format!("Failed to run curl: {}", e))?;
+ .map_err(|e| format!("Failed to run curl: {e}"))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
- return Err(format!("Failed to download WhisperX wheel: {}", stderr));
+ return Err(format!("Failed to download WhisperX wheel: {stderr}"));
}
if !whl_path.exists() {
return Err("WhisperX wheel was not downloaded".to_string());
}
- log::info!("Successfully downloaded WhisperX wheel to: {:?}", whl_path);
+ log::info!("Successfully downloaded WhisperX wheel to: {whl_path:?}");
Ok(whl_path)
}
@@ -1331,16 +1301,16 @@ fn install_whisperx_in_venv(venv_python: &PathBuf) -> Result<(), String> {
log::info!("Installing whisperx in virtual environment...");
let whl_path = download_whisperx_whl()?;
- log::info!("Installing WhisperX from: {:?}", whl_path);
+ log::info!("Installing WhisperX from: {whl_path:?}");
let install_result = Command::new(venv_python)
.args(["-m", "pip", "install", whl_path.to_str().unwrap()])
.output()
- .map_err(|e| format!("Failed to run pip install: {}", e))?;
+ .map_err(|e| format!("Failed to run pip install: {e}"))?;
if !install_result.status.success() {
let stderr = String::from_utf8_lossy(&install_result.stderr);
- return Err(format!("Failed to install whisperx: {}", stderr));
+ return Err(format!("Failed to install whisperx: {stderr}"));
}
log::info!("Successfully installed whisperx in virtual environment");
@@ -1422,7 +1392,7 @@ pub async fn prewarm_whisperx(model_path: String) -> Result<bool, String> {
let venv_python = match setup_whisperx_environment(&system_python) {
Ok(p) => p,
Err(e) => {
- log::info!("WhisperX environment not ready: {}, skipping pre-warm", e);
+ log::info!("WhisperX environment not ready: {e}, skipping pre-warm");
return Ok(false);
}
};
@@ -1450,7 +1420,7 @@ pub async fn prewarm_whisperx(model_path: String) -> Result<bool, String> {
*server_guard = Some(server);
}
Err(e) => {
- log::warn!("Failed to pre-warm WhisperX server: {}", e);
+ log::warn!("Failed to pre-warm WhisperX server: {e}");
}
}
});
@@ -1472,12 +1442,12 @@ pub async fn transcribe_audio(
log::info!("Language: {}", language);
if !std::path::Path::new(&video_path).exists() {
- log::error!("Video file not found at path: {}", video_path);
+ log::error!("Video file not found at path: {video_path}");
return Err(format!("Video file not found at path: {video_path}"));
}
if !std::path::Path::new(&model_path).exists() {
- log::error!("Model file not found at path: {}", model_path);
+ log::error!("Model file not found at path: {model_path}");
return Err(format!("Model file not found at path: {model_path}"));
}
@@ -1494,7 +1464,7 @@ pub async fn transcribe_audio(
}
if !audio_path.exists() {
- log::error!("Audio file was not created at {:?}", audio_path);
+ log::error!("Audio file was not created at {audio_path:?}");
return Err("Failed to create audio file for transcription".to_string());
}
@@ -1511,7 +1481,7 @@ pub async fn transcribe_audio(
log::info!("Detected model size: {}", model_size);
if let Some(system_python) = find_python() {
- log::info!("Found system Python at: {}", system_python);
+ log::info!("Found system Python at: {system_python}");
match setup_whisperx_environment(&system_python) {
Ok(venv_python) => {
@@ -1549,7 +1519,7 @@ pub async fn transcribe_audio(
*server_guard = Some(server);
}
Err(e) => {
- log::warn!("Failed to start WhisperX server: {}", e);
+ log::warn!("Failed to start WhisperX server: {e}");
return Err(e);
}
}
@@ -1572,8 +1542,7 @@ pub async fn transcribe_audio(
&& is_server_communication_error(e)
{
log::warn!(
- "Server communication error detected, clearing dead server: {}",
- e
+ "Server communication error detected, clearing dead server: {e}"
);
*server_guard = None;
}
@@ -1608,20 +1577,16 @@ pub async fn transcribe_audio(
}
}
Ok(Err(e)) => {
- log::warn!("WhisperX failed: {}. Falling back to built-in Whisper.", e);
+ log::warn!("WhisperX failed: {e}. Falling back to built-in Whisper.");
}
Err(e) => {
- log::warn!(
- "WhisperX task error: {}. Falling back to built-in Whisper.",
- e
- );
+ log::warn!("WhisperX task error: {e}. Falling back to built-in Whisper.");
}
}
}
Err(e) => {
log::warn!(
- "Failed to setup WhisperX environment: {}. Falling back to built-in Whisper.",
- e
+ "Failed to setup WhisperX environment: {e}. Falling back to built-in Whisper."
);
}
}
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index 3bab3baef..85630e45c 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -484,8 +484,7 @@ async fn set_camera_input(
Err(e) => {
if attempts >= 3 {
break Err(format!(
- "Failed to initialize camera after {} attempts: {}",
- attempts, e
+ "Failed to initialize camera after {attempts} attempts: {e}"
));
}
warn!(
diff --git a/apps/desktop/src-tauri/src/screenshot_editor.rs b/apps/desktop/src-tauri/src/screenshot_editor.rs
index 208b44405..4b0e41d91 100644
--- a/apps/desktop/src-tauri/src/screenshot_editor.rs
+++ b/apps/desktop/src-tauri/src/screenshot_editor.rs
@@ -158,7 +158,7 @@ impl ScreenshotEditorInstances {
.map(|e| e.path())
})
.ok_or_else(|| {
- format!("No PNG file found in directory: {:?}", path)
+ format!("No PNG file found in directory: {path:?}")
})?
}
} else {
@@ -465,15 +465,12 @@ pub async fn update_screenshot_config(
if parent.extension().and_then(|s| s.to_str()) == Some("cap") {
let path = parent.to_path_buf();
if let Err(e) = config.write(&path) {
- eprintln!("Failed to save screenshot config: {}", e);
+ eprintln!("Failed to save screenshot config: {e}");
} else {
- println!("Saved screenshot config to {:?}", path);
+ println!("Saved screenshot config to {path:?}");
}
} else {
- println!(
- "Not saving config: parent {:?} is not a .cap directory",
- parent
- );
+ println!("Not saving config: parent {parent:?} is not a .cap directory");
}
Ok(())
}
diff --git a/apps/desktop/src-tauri/src/update_project_names.rs b/apps/desktop/src-tauri/src/update_project_names.rs
index 723ad80b8..38e9f4542 100644
--- a/apps/desktop/src-tauri/src/update_project_names.rs
+++ b/apps/desktop/src-tauri/src/update_project_names.rs
@@ -17,7 +17,7 @@ const STORE_KEY: &str = "uuid_projects_migrated";
pub fn migrate_if_needed(app: &AppHandle) -> Result<(), String> {
let store = app
.store("store")
- .map_err(|e| format!("Failed to access store: {}", e))?;
+ .map_err(|e| format!("Failed to access store: {e}"))?;
if store
.get(STORE_KEY)
@@ -51,7 +51,7 @@ pub async fn migrate(app: &AppHandle) -> Result<(), String> {
let recordings_dir = recordings_path(app);
if !fs::try_exists(&recordings_dir)
.await
- .map_err(|e| format!("Failed to check recordings directory: {}", e))?
+ .map_err(|e| format!("Failed to check recordings directory: {e}"))?
{
return Ok(());
}
@@ -154,12 +154,12 @@ async fn collect_uuid_projects(recordings_dir: &Path) -> Result<Vec<PathBuf>, St
let mut uuid_projects = Vec::new();
let mut entries = fs::read_dir(recordings_dir)
.await
- .map_err(|e| format!("Failed to read recordings directory: {}", e))?;
+ .map_err(|e| format!("Failed to read recordings directory: {e}"))?;
while let Some(entry) = entries
.next_entry()
.await
- .map_err(|e| format!("Failed to read directory entry: {}", e))?
+ .map_err(|e| format!("Failed to read directory entry: {e}"))?
{
let path = entry.path();
if !path.is_dir() {
@@ -197,7 +197,7 @@ async fn migrate_single_project(
Ok(meta) => meta,
Err(e) => {
tracing::warn!("Failed to load metadata for {}: {}", filename, e);
- return Err(format!("Failed to load metadata: {}", e));
+ return Err(format!("Failed to load metadata: {e}"));
}
};
@@ -260,7 +260,7 @@ async fn migrate_project_filename_async(
let filename = if sanitized.ends_with(".cap") {
sanitized
} else {
- format!("{}.cap", sanitized)
+ format!("{sanitized}.cap")
};
let parent_dir = project_path
@@ -268,13 +268,13 @@ async fn migrate_project_filename_async(
.ok_or("Project path has no parent directory")?;
let unique_filename = cap_utils::ensure_unique_filename(&filename, parent_dir)
- .map_err(|e| format!("Failed to ensure unique filename: {}", e))?;
+ .map_err(|e| format!("Failed to ensure unique filename: {e}"))?;
let final_path = parent_dir.join(&unique_filename);
fs::rename(project_path, &final_path)
.await
- .map_err(|e| format!("Failed to rename project directory: {}", e))?;
+ .map_err(|e| format!("Failed to rename project directory: {e}"))?;
Ok(final_path)
}
diff --git a/apps/desktop/src-tauri/src/upload.rs b/apps/desktop/src-tauri/src/upload.rs
index f426ea2d9..5ba1b0bd7 100644
--- a/apps/desktop/src-tauri/src/upload.rs
+++ b/apps/desktop/src-tauri/src/upload.rs
@@ -230,7 +230,7 @@ pub async fn create_or_get_video(
}
if let Some(org_id) = organization_id {
- s3_config_url.push_str(&format!("&orgId={}", org_id));
+ s3_config_url.push_str(&format!("&orgId={org_id}"));
}
let response = app
diff --git a/crates/recording/src/recovery.rs b/crates/recording/src/recovery.rs
index dac11d84a..79f766980 100644
--- a/crates/recording/src/recovery.rs
+++ b/crates/recording/src/recovery.rs
@@ -455,14 +455,12 @@ impl RecoveryManager {
}
Ok(false) => {
return Err(RecoveryError::UnplayableVideo(format!(
- "Display video has no decodable frames: {:?}",
- display_output
+ "Display video has no decodable frames: {display_output:?}"
)));
}
Err(e) => {
return Err(RecoveryError::UnplayableVideo(format!(
- "Display video validation failed for {:?}: {}",
- display_output, e
+ "Display video validation failed for {display_output:?}: {e}"
)));
}
}
@@ -521,7 +519,8 @@ impl RecoveryManager {
.recoverable_segments
.iter()
.map(|seg| {
- let segment_base = format!("content/segments/segment-{}", seg.index);
+ let segment_index = seg.index;
+ let segment_base = format!("content/segments/segment-{segment_index}");
let segment_dir = recording.project_path.join(&segment_base);
let display_path = segment_dir.join("display.mp4");
@@ -534,13 +533,13 @@ impl RecoveryManager {
MultipleSegment {
display: VideoMeta {
- path: RelativePathBuf::from(format!("{}/display.mp4", segment_base)),
+ path: RelativePathBuf::from(format!("{segment_base}/display.mp4")),
fps,
start_time: None,
},
camera: if camera_path.exists() {
Some(VideoMeta {
- path: RelativePathBuf::from(format!("{}/camera.mp4", segment_base)),
+ path: RelativePathBuf::from(format!("{segment_base}/camera.mp4")),
fps: 30,
start_time: None,
})
@@ -549,10 +548,7 @@ impl RecoveryManager {
},
mic: if mic_path.exists() {
Some(AudioMeta {
- path: RelativePathBuf::from(format!(
- "{}/audio-input.ogg",
- segment_base
- )),
+ path: RelativePathBuf::from(format!("{segment_base}/audio-input.ogg")),
start_time: None,
})
} else {
@@ -560,20 +556,14 @@ impl RecoveryManager {
},
system_audio: if system_audio_path.exists() {
Some(AudioMeta {
- path: RelativePathBuf::from(format!(
- "{}/system_audio.ogg",
- segment_base
- )),
+ path: RelativePathBuf::from(format!("{segment_base}/system_audio.ogg")),
start_time: None,
})
} else {
None
},
cursor: if cursor_path.exists() {
- Some(RelativePathBuf::from(format!(
- "{}/cursor.json",
- segment_base
- )))
+ Some(RelativePathBuf::from(format!("{segment_base}/cursor.json")))
} else {
None
},
@@ -605,7 +595,7 @@ impl RecoveryManager {
.iter()
.enumerate()
.filter_map(|(i, segment)| {
- let segment_base = format!("content/segments/segment-{}", i);
+ let segment_base = format!("content/segments/segment-{i}");
let display_path = recording
.project_path
.join(&segment_base)
diff --git a/crates/rendering/src/decoder/avassetreader.rs b/crates/rendering/src/decoder/avassetreader.rs
index b8a5fe269..b53a43e3a 100644
--- a/crates/rendering/src/decoder/avassetreader.rs
+++ b/crates/rendering/src/decoder/avassetreader.rs
@@ -219,23 +219,23 @@ impl AVAssetReaderDecoder {
let mut frames = this.inner.frames();
let mut processor = ImageBufProcessor::new();
- let mut cache_hits = 0u64;
- let mut cache_misses = 0u64;
- let mut total_requests = 0u64;
- let mut total_decode_time_us = 0u64;
- let mut total_reset_count = 0u64;
- let mut total_reset_time_us = 0u64;
+ let mut _cache_hits = 0u64;
+ let mut _cache_misses = 0u64;
+ let mut _total_requests = 0u64;
+ let _total_decode_time_us = 0u64;
+ let mut _total_reset_count = 0u64;
+ let mut _total_reset_time_us = 0u64;
let last_metrics_log = Rc::new(RefCell::new(Instant::now()));
while let Ok(r) = rx.recv() {
match r {
VideoDecoderMessage::GetFrame(requested_time, sender) => {
let request_start = Instant::now();
- total_requests += 1;
+ _total_requests += 1;
let requested_frame = (requested_time * fps as f32).floor() as u32;
let mut sender = if let Some(cached) = cache.get(&requested_frame) {
- cache_hits += 1;
+ _cache_hits += 1;
let data = cached.data().clone();
let total_time = request_start.elapsed();
@@ -256,7 +256,7 @@ impl AVAssetReaderDecoder {
*last_sent_frame.borrow_mut() = Some(data);
continue;
} else {
- cache_misses += 1;
+ _cache_misses += 1;
let last_sent_frame = last_sent_frame.clone();
let request_start_clone = request_start;
let last_metrics_log_clone = last_metrics_log.clone();
@@ -302,7 +302,7 @@ impl AVAssetReaderDecoder {
if needs_reset {
let reset_start = Instant::now();
- total_reset_count += 1;
+ _total_reset_count += 1;
this.reset(requested_time);
frames = this.inner.frames();
*last_sent_frame.borrow_mut() = None;
@@ -316,7 +316,7 @@ impl AVAssetReaderDecoder {
let cleared = old_cache_size - retained;
let reset_time = reset_start.elapsed();
- total_reset_time_us += reset_time.as_micros() as u64;
+ _total_reset_time_us += reset_time.as_micros() as u64;
tracing::info!(
decoder = name,
@@ -325,7 +325,7 @@ impl AVAssetReaderDecoder {
reset_time_ms = reset_time.as_millis() as u64,
cleared_cache_entries = cleared,
retained_cache_entries = retained,
- total_resets = total_reset_count,
+ total_resets = _total_reset_count,
"[PERF:DECODER] decoder reset/seek"
);
}
diff --git a/crates/rendering/src/frame_pipeline.rs b/crates/rendering/src/frame_pipeline.rs
index 755cbfa63..114413501 100644
--- a/crates/rendering/src/frame_pipeline.rs
+++ b/crates/rendering/src/frame_pipeline.rs
@@ -386,7 +386,7 @@ pub async fn finish_encoder(
let total_start = Instant::now();
let previous_pending = session.pipelined_readback.take_pending();
- let has_previous = previous_pending.is_some();
+ let _has_previous = previous_pending.is_some();
let texture = if session.current_is_left {
&session.textures.0
diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs
index 7b0ed42f2..39eca69fa 100644
--- a/crates/utils/src/lib.rs
+++ b/crates/utils/src/lib.rs
@@ -89,9 +89,9 @@ pub fn ensure_unique_filename_with_attempts(
loop {
let numbered_filename = if extension.is_empty() {
- format!("{} ({})", name_without_ext, counter)
+ format!("{name_without_ext} ({counter})")
} else {
- format!("{} ({}){}", name_without_ext, counter, &extension)
+ format!("{name_without_ext} ({counter}){extension}")
};
let test_path = parent_dir.join(&numbered_filename);