Fix clippy collapsible_if in file_io3 cleanup

dev-check runs clippy with -D warnings against the solutions, which
flagged the nested if let Some(dir_path) = ... { if dir_path.exists() ... }
in file_cleanup as collapsible. Combined into a single if-let with a
let-chain condition (edition = "2024", so this is available).

Verified locally: compiles under --edition 2024, clippy is silent,
and the binary still runs cleanly with file size 117 and no leftover
files.
This commit is contained in:
Kivanc Gunalp 2026-07-26 15:34:10 +00:00
parent 68f8369cb4
commit e0859583b3
2 changed files with 12 additions and 12 deletions

View File

@ -67,13 +67,13 @@ fn file_cleanup() -> Result<(), std::io::Error> {
})?;
}
if let Some(dir_path) = path_buffer.parent() {
if dir_path.exists() {
if let Some(dir_path) = path_buffer.parent()
&& dir_path.exists()
{
fs::remove_dir(dir_path).inspect(|_| {
println!("Test dir removed");
})?;
}
}
Ok(())
}

View File

@ -66,13 +66,13 @@ fn file_cleanup() -> Result<(), std::io::Error> {
})?;
}
if let Some(dir_path) = path_buffer.parent() {
if dir_path.exists() {
if let Some(dir_path) = path_buffer.parent()
&& dir_path.exists()
{
fs::remove_dir(dir_path).inspect(|_| {
println!("Test dir removed");
})?;
}
}
Ok(())
}