Use write! instead of format! to pacify clippy

This commit is contained in:
Michael Vines 2022-05-22 19:10:48 -07:00
parent 9c20a06068
commit 9d9773bd2a
2 changed files with 14 additions and 6 deletions

View File

@ -3011,7 +3011,8 @@ fn main() {
if detail.skipped_reasons.is_empty() {
detail.skipped_reasons = format!("{:?}", skipped_reason);
} else {
detail.skipped_reasons += &format!("/{:?}", skipped_reason);
use std::fmt::Write;
let _ = write!(&mut detail.skipped_reasons, "/{:?}", skipped_reason);
}
}
}

View File

@ -51,6 +51,7 @@ use {
cmp,
collections::{hash_map::Entry as HashMapEntry, BTreeSet, HashMap, HashSet},
convert::TryInto,
fmt::Write,
fs,
io::{Error as IoError, ErrorKind},
path::{Path, PathBuf},
@ -3869,27 +3870,33 @@ pub fn create_new_ledger(
ledger_path.join(format!("{}.failed", DEFAULT_GENESIS_ARCHIVE)),
)
.unwrap_or_else(|e| {
error_messages += &format!(
let _ = write!(
&mut error_messages,
"/failed to stash problematic {}: {}",
DEFAULT_GENESIS_ARCHIVE, e
)
);
});
fs::rename(
&ledger_path.join(DEFAULT_GENESIS_FILE),
ledger_path.join(format!("{}.failed", DEFAULT_GENESIS_FILE)),
)
.unwrap_or_else(|e| {
error_messages += &format!(
let _ = write!(
&mut error_messages,
"/failed to stash problematic {}: {}",
DEFAULT_GENESIS_FILE, e
)
);
});
fs::rename(
&ledger_path.join(blockstore_dir),
ledger_path.join(format!("{}.failed", blockstore_dir)),
)
.unwrap_or_else(|e| {
error_messages += &format!("/failed to stash problematic {}: {}", blockstore_dir, e)
let _ = write!(
&mut error_messages,
"/failed to stash problematic {}: {}",
blockstore_dir, e
);
});
return Err(BlockstoreError::Io(IoError::new(