Inlines variables into format strings (#29945)

This commit is contained in:
Brooks 2023-01-27 01:23:03 -05:00 committed by GitHub
parent daea6722f6
commit 685c22ff41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -897,7 +897,7 @@ pub(crate) mod tests {
.take(100)
.filter(|peer| peer != old)
.count();
assert!(count < 75, "count of peer != old: {}", count);
assert!(count < 75, "count of peer != old: {count}");
}
#[test]

View File

@ -40,10 +40,10 @@ impl Display for SlotBounds<'_> {
)?;
if let Some(all_slots) = self.all_slots {
writeln!(f, "Non-empty slots: {:?}", all_slots)?;
writeln!(f, "Non-empty slots: {all_slots:?}")?;
}
} else {
writeln!(f, "Ledger has data for slot {:?}", first)?;
writeln!(f, "Ledger has data for slot {first:?}")?;
}
if self.roots.total > 0 {
@ -56,11 +56,7 @@ impl Display for SlotBounds<'_> {
self.roots.total, first_rooted, last_rooted
)?;
writeln!(
f,
" and {:?} slots past the last root",
num_after_last_root
)?;
writeln!(f, " and {num_after_last_root:?} slots past the last root")?;
} else {
writeln!(f, " with no rooted slots")?;
}

View File

@ -160,8 +160,7 @@ fn find_installed_sbf_tools(arch: &str) -> Vec<String> {
fn get_latest_sbf_tools_version() -> Result<String, String> {
let url = "https://github.com/solana-labs/sbf-tools/releases/latest";
let resp =
reqwest::blocking::get(url).map_err(|err| format!("Failed to GET {}: {}", url, err))?;
let resp = reqwest::blocking::get(url).map_err(|err| format!("Failed to GET {url}: {err}"))?;
let path = std::path::Path::new(resp.url().path());
let version = path.file_name().unwrap().to_string_lossy().to_string();
Ok(version)
@ -173,7 +172,7 @@ fn normalize_version(version: String) -> String {
|n: u32, c| if *c == b'.' { n.saturating_add(1) } else { n },
);
if dots == 1 {
format!("{}.0", version)
format!("{version}.0")
} else {
version
}

View File

@ -113,7 +113,7 @@ impl Dashboard {
println_name_value("JSON RPC URL:", &format!("http://{rpc}"));
}
if let Some(pubsub) = contact_info.pubsub {
println_name_value("WebSocket PubSub URL:", &format!("ws://{}", pubsub));
println_name_value("WebSocket PubSub URL:", &format!("ws://{pubsub}"));
}
}