cleanup rename_corrupted_chunk: avoid duplicate format macro
This commit is contained in:
parent
0f3b7efa84
commit
aadcc2815c
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue