perf, pedantic, nursery, and unwrap_used clippy fixes

This commit is contained in:
Chris Cochrun 2025-09-15 11:19:27 -05:00
parent a186d3bec4
commit 3fe77c93e2
15 changed files with 195 additions and 207 deletions

View file

@ -11,7 +11,9 @@ pub fn bg_from_video(
video: &Path,
screenshot: &Path,
) -> Result<(), Box<dyn Error>> {
if !screenshot.exists() {
if screenshot.exists() {
debug!("Screenshot already exists");
} else {
let output_duration = Command::new("ffprobe")
.args(["-i", &video.to_string_lossy()])
.output()
@ -26,9 +28,9 @@ pub fn bg_from_video(
let mut duration = log.split_off(duration_index + 10);
duration.truncate(11);
// debug!("rust-duration-is: {duration}");
let mut hours = String::from("");
let mut minutes = String::from("");
let mut seconds = String::from("");
let mut hours = String::new();
let mut minutes = String::new();
let mut seconds = String::new();
for (i, c) in duration.chars().enumerate() {
if i <= 1 {
hours.push(c);
@ -63,8 +65,6 @@ pub fn bg_from_video(
.expect("failed to execute ffmpeg");
// io::stdout().write_all(&output.stdout).unwrap();
// io::stderr().write_all(&output.stderr).unwrap();
} else {
debug!("Screenshot already exists");
}
Ok(())
}