enforce stricter lints, drop discarded results properly
This commit is contained in:
@@ -149,7 +149,7 @@ where
|
||||
ArchiveKind::SevenZ => extract_ffmpeg_from_7z(&archive_path, dest),
|
||||
ArchiveKind::Zip => extract_ffmpeg_from_zip(&archive_path, dest),
|
||||
};
|
||||
let _ = fs::remove_file(&archive_path);
|
||||
drop(fs::remove_file(&archive_path));
|
||||
result
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ where
|
||||
file.flush()?;
|
||||
let got: [u8; 32] = hasher.finalize().into();
|
||||
if &got != expected {
|
||||
let _ = std::fs::remove_file(dest);
|
||||
drop(std::fs::remove_file(dest));
|
||||
bail!(
|
||||
"sha256 mismatch: expected {} got {}",
|
||||
hex::encode(expected),
|
||||
@@ -294,7 +294,7 @@ fn extract_ffmpeg_from_7z(archive_path: &Path, dest: &Path) -> Result<()> {
|
||||
.and_then(|p| p.parent())
|
||||
.context("invalid dest path")?;
|
||||
let scratch = app_dir.join("temp").join("ffmpeg-extract");
|
||||
let _ = fs::remove_dir_all(&scratch);
|
||||
drop(fs::remove_dir_all(&scratch));
|
||||
fs::create_dir_all(&scratch).context("create 7z scratch dir")?;
|
||||
|
||||
let file = std::fs::File::open(archive_path).context("opening 7z archive")?;
|
||||
@@ -302,7 +302,7 @@ fn extract_ffmpeg_from_7z(archive_path: &Path, dest: &Path) -> Result<()> {
|
||||
sevenz_rust2::decompress_with_extract_fn(file, &scratch, |_, _, _| Ok(true))
|
||||
.map_err(|e| anyhow!("7z extraction failed: {e}"));
|
||||
let found = find_ffmpeg_in(&scratch);
|
||||
let _ = fs::remove_dir_all(&scratch);
|
||||
drop(fs::remove_dir_all(&scratch));
|
||||
|
||||
extract_result?;
|
||||
let Some(src) = found else {
|
||||
|
||||
Reference in New Issue
Block a user