chore: Remove unused function delete_files_in_dir() (#6454)

This commit is contained in:
Hocuri
2025-01-20 18:53:36 +01:00
committed by GitHub
parent e3b9c9b209
commit 39bf3bee59

View File

@@ -26,7 +26,7 @@ use chrono::{Local, NaiveDateTime, NaiveTime, TimeZone};
use deltachat_contact_tools::EmailAddress;
#[cfg(test)]
pub use deltachat_time::SystemTimeTools as SystemTime;
use futures::{StreamExt, TryStreamExt};
use futures::TryStreamExt;
use mailparse::dateparse;
use mailparse::headers::Headers;
use mailparse::MailHeaderMap;
@@ -366,22 +366,6 @@ pub(crate) async fn delete_file(context: &Context, path: impl AsRef<Path>) -> Re
Ok(())
}
pub async fn delete_files_in_dir(context: &Context, path: impl AsRef<Path>) -> Result<()> {
let read_dir = tokio::fs::read_dir(path)
.await
.context("could not read dir to delete")?;
let mut read_dir = tokio_stream::wrappers::ReadDirStream::new(read_dir);
while let Some(entry) = read_dir.next().await {
match entry {
Ok(file) => {
delete_file(context, file.file_name()).await?;
}
Err(e) => warn!(context, "Could not read file to delete: {}", e),
}
}
Ok(())
}
/// A guard which will remove the path when dropped.
///
/// It implements [`Deref`] so it can be used as a `&Path`.