chore: inline variables to format strings

Found by new clippy.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2025-06-27 08:41:19 +03:00
parent d824691e1a
commit d5f684b2ec
8 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -43,10 +43,10 @@ mod cibtoolcmd;
fn main() {
logger::open(logger::LogLevel::Info);
if let Err(e) = fallible_main() {
eprintln!("ERROR: {}", e);
eprintln!("ERROR: {e}");
let mut e = e.source();
while let Some(source) = e {
eprintln!("caused by: {}", source);
eprintln!("caused by: {source}");
e = source.source();
}
exit(1);
+2 -2
View File
@@ -39,11 +39,11 @@ impl Leaf for ListEvents {
let events = events?;
let json =
serde_json::to_string_pretty(&events).map_err(CibToolError::EventListToJson)?;
println!("{}", json);
println!("{json}");
} else if self.verbose {
for id in event_ids {
if let Some(e) = db.get_queued_ci_event(&id)? {
println!("{id}: {:?}", e);
println!("{id}: {e:?}");
} else {
println!("{id}: No such event");
}
+1 -1
View File
@@ -41,7 +41,7 @@ impl Leaf for MessageCmd {
MessageKind::Failure => response_json(failure()?)?,
};
println!("{}", msg);
println!("{msg}");
Ok(())
}
+1 -1
View File
@@ -98,7 +98,7 @@ impl Leaf for TimeoutCmd {
println!("stdout bytes: {stdout_bytes}");
println!("duration: {} ms", elapsed.as_millis());
println!("speed: {:.0} B/s", speed);
println!("speed: {speed:.0} B/s");
println!("exit: {}", tor.exit_code());
Ok(())
+1 -1
View File
@@ -722,7 +722,7 @@ impl std::fmt::Display for Author {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.id)?;
if let Some(alias) = &self.alias {
write!(f, " ({})", alias)?;
write!(f, " ({alias})")?;
}
Ok(())
}
+1 -1
View File
@@ -337,7 +337,7 @@ impl PageData {
fn per_repo_page_as_html(&self, rid: RepoId, alias: &str, timestamp: &str) -> HtmlPage {
let mut doc = HtmlPage::default();
let title = format!("CI runs for repository {}", alias);
let title = format!("CI runs for repository {alias}");
Self::head(&mut doc, &title);
doc.push_to_body(
+1 -1
View File
@@ -177,7 +177,7 @@ impl fmt::Display for RunState {
Self::Running => "running",
Self::Triggered => "triggered",
};
write!(f, "{}", s)
write!(f, "{s}")
}
}
+2 -2
View File
@@ -34,14 +34,14 @@ pub struct Sensitive {
impl fmt::Display for Sensitive {
/// Serialize for normal output.
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(f, "{}", PLACEHOLDER)
write!(f, "{PLACEHOLDER}")
}
}
impl fmt::Debug for Sensitive {
/// Serialize for debug output.
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
write!(f, "{}", PLACEHOLDER)
write!(f, "{PLACEHOLDER}")
}
}