Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

chore: clean up format strings and lint warnings

Richie McIlroyba7c26ccb367
diff --git a/apps/desktop/src-tauri/src/audio.rs b/apps/desktop/src-tauri/src/audio.rs
index 7cca0218f..7c717bd22 100644
--- a/apps/desktop/src-tauri/src/audio.rs
+++ b/apps/desktop/src-tauri/src/audio.rs
@@ -15,6 +15,7 @@ fn play_audio(bytes: &'static [u8]) {
});
}
+#[allow(dead_code)]
pub enum AppSounds {
StartRecording,
StopRecording,
diff --git a/apps/desktop/src-tauri/src/import.rs b/apps/desktop/src-tauri/src/import.rs
index c155654b5..c37b701bb 100644
--- a/apps/desktop/src-tauri/src/import.rs
+++ b/apps/desktop/src-tauri/src/import.rs
@@ -88,7 +88,7 @@ fn generate_project_name(source_path: &Path) -> String {
let now = chrono::Local::now();
let date_str = now.format("%Y-%m-%d at %H.%M.%S").to_string();
- format!("{} {}", stem, date_str)
+ format!("{stem} {date_str}")
}
fn sanitize_filename(name: &str) -> String {
@@ -443,12 +443,12 @@ pub async fn start_video_import(app: AppHandle, source_path: PathBuf) -> Result<
let project_name = generate_project_name(&source_path);
let sanitized_name = sanitize_filename(&project_name);
- let project_dir_name = format!("{}.cap", sanitized_name);
+ let project_dir_name = format!("{sanitized_name}.cap");
let mut project_path = recordings_dir.join(&project_dir_name);
let mut counter = 1;
while project_path.exists() {
- let new_name = format!("{} ({}).cap", sanitized_name, counter);
+ let new_name = format!("{sanitized_name} ({counter}).cap");
project_path = recordings_dir.join(new_name);
counter += 1;
}
diff --git a/crates/export/tests/long_video_export.rs b/crates/export/tests/long_video_export.rs
index 279eca426..136bfe7b8 100644
--- a/crates/export/tests/long_video_export.rs
+++ b/crates/export/tests/long_video_export.rs
@@ -36,8 +36,7 @@ fn generate_test_video(output_path: &Path, duration_secs: u32) -> Result<(), Str
"lavfi",
"-i",
&format!(
- "testsrc=duration={}:size={}x{}:rate={}",
- duration_secs, TEST_VIDEO_WIDTH, TEST_VIDEO_HEIGHT, TEST_VIDEO_FPS
+ "testsrc=duration={duration_secs}:size={TEST_VIDEO_WIDTH}x{TEST_VIDEO_HEIGHT}:rate={TEST_VIDEO_FPS}"
),
"-c:v",
"libx264",
@@ -137,7 +136,7 @@ async fn run_export(project_path: PathBuf, fps: u32) -> Result<(PathBuf, Duratio
};
let total_frames = exporter_base.total_frames(fps);
- println!("Starting export of {} frames at {} fps", total_frames, fps);
+ println!("Starting export of {total_frames} frames at {fps} fps");
let start = Instant::now();
let last_frame = Arc::new(AtomicU32::new(0));
@@ -185,7 +184,7 @@ async fn test_export_35_minute_video() -> Result<(), Box<dyn std::error::Error>>
let project_dir = temp_dir.path().to_path_buf();
let duration_secs = TEST_VIDEO_DURATION_SECS;
- println!("Creating Cap project structure in {:?}", project_dir);
+ println!("Creating Cap project structure in {project_dir:?}");
create_cap_project(&project_dir, duration_secs)?;
let video_path = project_dir.join("content/display.mp4");
@@ -215,7 +214,7 @@ async fn test_export_35_minute_video() -> Result<(), Box<dyn std::error::Error>>
output_path.display()
);
- let expected_frames = (duration_secs * 30) as u32;
+ let expected_frames = duration_secs * 30;
let tolerance = expected_frames / 100;
assert!(
frames >= expected_frames - tolerance,
@@ -245,7 +244,7 @@ async fn test_export_10_minute_video() -> Result<(), Box<dyn std::error::Error>>
let temp_dir = TempDir::new()?;
let project_dir = temp_dir.path().to_path_buf();
- println!("Creating Cap project structure in {:?}", project_dir);
+ println!("Creating Cap project structure in {project_dir:?}");
create_cap_project(&project_dir, duration_secs)?;
let video_path = project_dir.join("content/display.mp4");
@@ -266,7 +265,7 @@ async fn test_export_10_minute_video() -> Result<(), Box<dyn std::error::Error>>
output_path.display()
);
- let expected_frames = (duration_secs * 30) as u32;
+ let expected_frames = duration_secs * 30;
let tolerance = expected_frames / 100;
assert!(
frames >= expected_frames - tolerance,
@@ -296,7 +295,7 @@ async fn test_export_55_minute_video() -> Result<(), Box<dyn std::error::Error>>
let temp_dir = TempDir::new()?;
let project_dir = temp_dir.path().to_path_buf();
- println!("Creating Cap project structure in {:?}", project_dir);
+ println!("Creating Cap project structure in {project_dir:?}");
create_cap_project(&project_dir, duration_secs)?;
let video_path = project_dir.join("content/display.mp4");
@@ -323,7 +322,7 @@ async fn test_export_55_minute_video() -> Result<(), Box<dyn std::error::Error>>
output_path.display()
);
- let expected_frames = (duration_secs * 30) as u32;
+ let expected_frames = duration_secs * 30;
let tolerance = expected_frames / 100;
assert!(
frames >= expected_frames - tolerance,
diff --git a/crates/recording/examples/playback-test-runner.rs b/crates/recording/examples/playback-test-runner.rs
index adfe615f7..07e0d6863 100644
--- a/crates/recording/examples/playback-test-runner.rs
+++ b/crates/recording/examples/playback-test-runner.rs
@@ -304,7 +304,7 @@ async fn test_decoder(video_path: &Path, fps: u32, is_camera: bool) -> DecoderTe
let name = if is_camera { "camera" } else { "display" };
let start = Instant::now();
- match spawn_decoder(name, video_path.to_path_buf(), fps, 0.0).await {
+ match spawn_decoder(name, video_path.to_path_buf(), fps, 0.0, false).await {
Ok(decoder) => {
result.init_time_ms = start.elapsed().as_secs_f64() * 1000.0;
result.decoder_type = format!("{}", decoder.decoder_type());
@@ -347,7 +347,7 @@ async fn test_playback(
}
};
- let decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0).await {
+ let decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0, false).await {
Ok(d) => d,
Err(e) => {
result.errors.push(format!("Failed to create decoder: {e}"));
@@ -579,17 +579,18 @@ async fn test_camera_sync(
result.drift_ok = true;
}
- let display_decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0).await {
- Ok(d) => d,
- Err(e) => {
- result
- .errors
- .push(format!("Failed to create display decoder: {e}"));
- return result;
- }
- };
+ let display_decoder =
+ match spawn_decoder("display", display_path.clone(), fps, 0.0, false).await {
+ Ok(d) => d,
+ Err(e) => {
+ result
+ .errors
+ .push(format!("Failed to create display decoder: {e}"));
+ return result;
+ }
+ };
- let camera_decoder = match spawn_decoder("camera", camera_path.clone(), fps, 0.0).await {
+ let camera_decoder = match spawn_decoder("camera", camera_path.clone(), fps, 0.0, false).await {
Ok(d) => {
result.camera_decoder_ok = true;
d