mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-08-14 14:26:56 +00:00
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:
parent
68f8369cb4
commit
e0859583b3
@ -67,12 +67,12 @@ fn file_cleanup() -> Result<(), std::io::Error> {
|
|||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(dir_path) = path_buffer.parent() {
|
if let Some(dir_path) = path_buffer.parent()
|
||||||
if dir_path.exists() {
|
&& dir_path.exists()
|
||||||
fs::remove_dir(dir_path).inspect(|_| {
|
{
|
||||||
println!("Test dir removed");
|
fs::remove_dir(dir_path).inspect(|_| {
|
||||||
})?;
|
println!("Test dir removed");
|
||||||
}
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -66,12 +66,12 @@ fn file_cleanup() -> Result<(), std::io::Error> {
|
|||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(dir_path) = path_buffer.parent() {
|
if let Some(dir_path) = path_buffer.parent()
|
||||||
if dir_path.exists() {
|
&& dir_path.exists()
|
||||||
fs::remove_dir(dir_path).inspect(|_| {
|
{
|
||||||
println!("Test dir removed");
|
fs::remove_dir(dir_path).inspect(|_| {
|
||||||
})?;
|
println!("Test dir removed");
|
||||||
}
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user