Inlines variables into format strings (#29945)
This commit is contained in:
parent
daea6722f6
commit
685c22ff41
|
@ -897,7 +897,7 @@ pub(crate) mod tests {
|
||||||
.take(100)
|
.take(100)
|
||||||
.filter(|peer| peer != old)
|
.filter(|peer| peer != old)
|
||||||
.count();
|
.count();
|
||||||
assert!(count < 75, "count of peer != old: {}", count);
|
assert!(count < 75, "count of peer != old: {count}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -40,10 +40,10 @@ impl Display for SlotBounds<'_> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if let Some(all_slots) = self.all_slots {
|
if let Some(all_slots) = self.all_slots {
|
||||||
writeln!(f, "Non-empty slots: {:?}", all_slots)?;
|
writeln!(f, "Non-empty slots: {all_slots:?}")?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
writeln!(f, "Ledger has data for slot {:?}", first)?;
|
writeln!(f, "Ledger has data for slot {first:?}")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.roots.total > 0 {
|
if self.roots.total > 0 {
|
||||||
|
@ -56,11 +56,7 @@ impl Display for SlotBounds<'_> {
|
||||||
self.roots.total, first_rooted, last_rooted
|
self.roots.total, first_rooted, last_rooted
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
writeln!(
|
writeln!(f, " and {num_after_last_root:?} slots past the last root")?;
|
||||||
f,
|
|
||||||
" and {:?} slots past the last root",
|
|
||||||
num_after_last_root
|
|
||||||
)?;
|
|
||||||
} else {
|
} else {
|
||||||
writeln!(f, " with no rooted slots")?;
|
writeln!(f, " with no rooted slots")?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,8 +160,7 @@ fn find_installed_sbf_tools(arch: &str) -> Vec<String> {
|
||||||
|
|
||||||
fn get_latest_sbf_tools_version() -> Result<String, String> {
|
fn get_latest_sbf_tools_version() -> Result<String, String> {
|
||||||
let url = "https://github.com/solana-labs/sbf-tools/releases/latest";
|
let url = "https://github.com/solana-labs/sbf-tools/releases/latest";
|
||||||
let resp =
|
let resp = reqwest::blocking::get(url).map_err(|err| format!("Failed to GET {url}: {err}"))?;
|
||||||
reqwest::blocking::get(url).map_err(|err| format!("Failed to GET {}: {}", url, err))?;
|
|
||||||
let path = std::path::Path::new(resp.url().path());
|
let path = std::path::Path::new(resp.url().path());
|
||||||
let version = path.file_name().unwrap().to_string_lossy().to_string();
|
let version = path.file_name().unwrap().to_string_lossy().to_string();
|
||||||
Ok(version)
|
Ok(version)
|
||||||
|
@ -173,7 +172,7 @@ fn normalize_version(version: String) -> String {
|
||||||
|n: u32, c| if *c == b'.' { n.saturating_add(1) } else { n },
|
|n: u32, c| if *c == b'.' { n.saturating_add(1) } else { n },
|
||||||
);
|
);
|
||||||
if dots == 1 {
|
if dots == 1 {
|
||||||
format!("{}.0", version)
|
format!("{version}.0")
|
||||||
} else {
|
} else {
|
||||||
version
|
version
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl Dashboard {
|
||||||
println_name_value("JSON RPC URL:", &format!("http://{rpc}"));
|
println_name_value("JSON RPC URL:", &format!("http://{rpc}"));
|
||||||
}
|
}
|
||||||
if let Some(pubsub) = contact_info.pubsub {
|
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}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue