From 9fb105c801e2999a24f0773443d6164e30c9ff0c Mon Sep 17 00:00:00 2001 From: Brooks Date: Tue, 27 Jun 2023 15:51:28 -0400 Subject: [PATCH] Cleanup impl for remove_tmp_snapshot_archives() (#32297) --- runtime/src/snapshot_utils.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index ee3ad07e49..0a83d60a1f 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -623,11 +623,12 @@ fn is_bank_snapshot_complete(bank_snapshot_dir: impl AsRef) -> bool { pub fn remove_tmp_snapshot_archives(snapshot_archives_dir: impl AsRef) { if let Ok(entries) = std::fs::read_dir(snapshot_archives_dir) { for entry in entries.flatten() { - let file_name = entry + if entry .file_name() - .into_string() - .unwrap_or_else(|_| String::new()); - if file_name.starts_with(TMP_SNAPSHOT_ARCHIVE_PREFIX) { + .to_str() + .map(|file_name| file_name.starts_with(TMP_SNAPSHOT_ARCHIVE_PREFIX)) + .unwrap_or(false) + { let path = entry.path(); let result = if path.is_dir() { fs_err::remove_dir_all(path)