From aadcc2815c0c19c2535c96df1d42918ac77f8e82 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 8 Sep 2020 12:29:53 +0200 Subject: [PATCH] cleanup rename_corrupted_chunk: avoid duplicate format macro --- src/backup/verify.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backup/verify.rs b/src/backup/verify.rs index 697ed236..a96c5723 100644 --- a/src/backup/verify.rs +++ b/src/backup/verify.rs @@ -48,10 +48,9 @@ fn rename_corrupted_chunk( let mut counter = 0; let mut new_path = path.clone(); - new_path.set_file_name(format!("{}.{}.bad", digest_str, counter)); - while new_path.exists() && counter < 9 { - counter += 1; + loop { new_path.set_file_name(format!("{}.{}.bad", digest_str, counter)); + if new_path.exists() && counter < 9 { counter += 1; } else { break; } } match std::fs::rename(&path, &new_path) {