cleanup rename_corrupted_chunk: avoid duplicate format macro

This commit is contained in:
Dietmar Maurer 2020-09-08 12:29:53 +02:00
parent 0f3b7efa84
commit aadcc2815c
1 changed files with 2 additions and 3 deletions

View File

@ -48,10 +48,9 @@ fn rename_corrupted_chunk(
let mut counter = 0; let mut counter = 0;
let mut new_path = path.clone(); let mut new_path = path.clone();
loop {
new_path.set_file_name(format!("{}.{}.bad", digest_str, counter)); new_path.set_file_name(format!("{}.{}.bad", digest_str, counter));
while new_path.exists() && counter < 9 { if new_path.exists() && counter < 9 { counter += 1; } else { break; }
counter += 1;
new_path.set_file_name(format!("{}.{}.bad", digest_str, counter));
} }
match std::fs::rename(&path, &new_path) { match std::fs::rename(&path, &new_path) {