Skip to content

Commit ba7c26c

Browse files
committed
chore: clean up format strings and lint warnings
1 parent f09e9e8 commit ba7c26c

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

apps/desktop/src-tauri/src/audio.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn play_audio(bytes: &'static [u8]) {
1515
});
1616
}
1717

18+
#[allow(dead_code)]
1819
pub enum AppSounds {
1920
StartRecording,
2021
StopRecording,

apps/desktop/src-tauri/src/import.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn generate_project_name(source_path: &Path) -> String {
8888
let now = chrono::Local::now();
8989
let date_str = now.format("%Y-%m-%d at %H.%M.%S").to_string();
9090

91-
format!("{} {}", stem, date_str)
91+
format!("{stem} {date_str}")
9292
}
9393

9494
fn sanitize_filename(name: &str) -> String {
@@ -443,12 +443,12 @@ pub async fn start_video_import(app: AppHandle, source_path: PathBuf) -> Result<
443443

444444
let project_name = generate_project_name(&source_path);
445445
let sanitized_name = sanitize_filename(&project_name);
446-
let project_dir_name = format!("{}.cap", sanitized_name);
446+
let project_dir_name = format!("{sanitized_name}.cap");
447447

448448
let mut project_path = recordings_dir.join(&project_dir_name);
449449
let mut counter = 1;
450450
while project_path.exists() {
451-
let new_name = format!("{} ({}).cap", sanitized_name, counter);
451+
let new_name = format!("{sanitized_name} ({counter}).cap");
452452
project_path = recordings_dir.join(new_name);
453453
counter += 1;
454454
}

crates/export/tests/long_video_export.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ fn generate_test_video(output_path: &Path, duration_secs: u32) -> Result<(), Str
3636
"lavfi",
3737
"-i",
3838
&format!(
39-
"testsrc=duration={}:size={}x{}:rate={}",
40-
duration_secs, TEST_VIDEO_WIDTH, TEST_VIDEO_HEIGHT, TEST_VIDEO_FPS
39+
"testsrc=duration={duration_secs}:size={TEST_VIDEO_WIDTH}x{TEST_VIDEO_HEIGHT}:rate={TEST_VIDEO_FPS}"
4140
),
4241
"-c:v",
4342
"libx264",
@@ -137,7 +136,7 @@ async fn run_export(project_path: PathBuf, fps: u32) -> Result<(PathBuf, Duratio
137136
};
138137

139138
let total_frames = exporter_base.total_frames(fps);
140-
println!("Starting export of {} frames at {} fps", total_frames, fps);
139+
println!("Starting export of {total_frames} frames at {fps} fps");
141140

142141
let start = Instant::now();
143142
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>>
185184
let project_dir = temp_dir.path().to_path_buf();
186185

187186
let duration_secs = TEST_VIDEO_DURATION_SECS;
188-
println!("Creating Cap project structure in {:?}", project_dir);
187+
println!("Creating Cap project structure in {project_dir:?}");
189188
create_cap_project(&project_dir, duration_secs)?;
190189

191190
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>>
215214
output_path.display()
216215
);
217216

218-
let expected_frames = (duration_secs * 30) as u32;
217+
let expected_frames = duration_secs * 30;
219218
let tolerance = expected_frames / 100;
220219
assert!(
221220
frames >= expected_frames - tolerance,
@@ -245,7 +244,7 @@ async fn test_export_10_minute_video() -> Result<(), Box<dyn std::error::Error>>
245244
let temp_dir = TempDir::new()?;
246245
let project_dir = temp_dir.path().to_path_buf();
247246

248-
println!("Creating Cap project structure in {:?}", project_dir);
247+
println!("Creating Cap project structure in {project_dir:?}");
249248
create_cap_project(&project_dir, duration_secs)?;
250249

251250
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>>
266265
output_path.display()
267266
);
268267

269-
let expected_frames = (duration_secs * 30) as u32;
268+
let expected_frames = duration_secs * 30;
270269
let tolerance = expected_frames / 100;
271270
assert!(
272271
frames >= expected_frames - tolerance,
@@ -296,7 +295,7 @@ async fn test_export_55_minute_video() -> Result<(), Box<dyn std::error::Error>>
296295
let temp_dir = TempDir::new()?;
297296
let project_dir = temp_dir.path().to_path_buf();
298297

299-
println!("Creating Cap project structure in {:?}", project_dir);
298+
println!("Creating Cap project structure in {project_dir:?}");
300299
create_cap_project(&project_dir, duration_secs)?;
301300

302301
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>>
323322
output_path.display()
324323
);
325324

326-
let expected_frames = (duration_secs * 30) as u32;
325+
let expected_frames = duration_secs * 30;
327326
let tolerance = expected_frames / 100;
328327
assert!(
329328
frames >= expected_frames - tolerance,

crates/recording/examples/playback-test-runner.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ async fn test_decoder(video_path: &Path, fps: u32, is_camera: bool) -> DecoderTe
304304
let name = if is_camera { "camera" } else { "display" };
305305

306306
let start = Instant::now();
307-
match spawn_decoder(name, video_path.to_path_buf(), fps, 0.0).await {
307+
match spawn_decoder(name, video_path.to_path_buf(), fps, 0.0, false).await {
308308
Ok(decoder) => {
309309
result.init_time_ms = start.elapsed().as_secs_f64() * 1000.0;
310310
result.decoder_type = format!("{}", decoder.decoder_type());
@@ -347,7 +347,7 @@ async fn test_playback(
347347
}
348348
};
349349

350-
let decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0).await {
350+
let decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0, false).await {
351351
Ok(d) => d,
352352
Err(e) => {
353353
result.errors.push(format!("Failed to create decoder: {e}"));
@@ -579,17 +579,18 @@ async fn test_camera_sync(
579579
result.drift_ok = true;
580580
}
581581

582-
let display_decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0).await {
583-
Ok(d) => d,
584-
Err(e) => {
585-
result
586-
.errors
587-
.push(format!("Failed to create display decoder: {e}"));
588-
return result;
589-
}
590-
};
582+
let display_decoder =
583+
match spawn_decoder("display", display_path.clone(), fps, 0.0, false).await {
584+
Ok(d) => d,
585+
Err(e) => {
586+
result
587+
.errors
588+
.push(format!("Failed to create display decoder: {e}"));
589+
return result;
590+
}
591+
};
591592

592-
let camera_decoder = match spawn_decoder("camera", camera_path.clone(), fps, 0.0).await {
593+
let camera_decoder = match spawn_decoder("camera", camera_path.clone(), fps, 0.0, false).await {
593594
Ok(d) => {
594595
result.camera_decoder_ok = true;
595596
d

0 commit comments

Comments
 (0)