diff --git a/crates/tor-persist/src/fs/clean.rs b/crates/tor-persist/src/fs/clean.rs index 27578cee879b0d5eb5a0cec68da25598cd233fa1..a488c40c2dd619d2f02bae795b0640b90d5125ec 100644 --- a/crates/tor-persist/src/fs/clean.rs +++ b/crates/tor-persist/src/fs/clean.rs @@ -67,7 +67,10 @@ pub(super) fn files_to_delete(statepath: &Path, now: SystemTime) -> Vec<PathBuf> .map_err(dir_read_failed) // Result from fs::read_dir .into_iter() .flatten() - .map_while(|result| result.map_err(dir_read_failed).ok()); // Result from dir.next() + // TODO: Use map_while once we are on Rust >= 1.57 + .map(|result| result.map_err(dir_read_failed).ok()) // Result from dir.next() + .take_while(|result| result.is_some()) + .flatten(); for entry in entries { let path = entry.path();