From 95533888c7bc0af73d4610ce99e0cd0dc442f58a Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 28 Oct 2022 15:02:20 +0200 Subject: [PATCH] Apply clippy::uninlined_format_args fixes --- build.rs | 6 +++--- src/actions/experiments/edit.rs | 2 +- src/agent/api.rs | 6 +++--- src/crates/mod.rs | 8 ++++---- src/db/migrations.rs | 14 +++++++------- src/experiments.rs | 8 ++++---- src/report/archives.rs | 8 ++++---- src/report/markdown.rs | 4 ++-- src/report/mod.rs | 10 +++++----- src/report/s3.rs | 2 +- src/runner/mod.rs | 2 +- src/runner/tasks.rs | 4 ++-- src/server/auth.rs | 6 +++--- src/server/github.rs | 18 +++++++++--------- src/server/reports.rs | 8 ++++---- src/server/routes/metrics.rs | 2 +- src/server/routes/ui/experiments.rs | 2 +- src/server/routes/webhooks/commands.rs | 14 +++++++------- src/server/routes/webhooks/mod.rs | 4 ++-- src/server/tokens.rs | 2 +- src/toolchain.rs | 10 +++++----- src/utils/size.rs | 10 +++++----- tests/common/cli_utils.rs | 2 +- tests/minicrater/driver.rs | 2 +- 24 files changed, 77 insertions(+), 77 deletions(-) diff --git a/build.rs b/build.rs index 036dd620b..4941e7ae4 100644 --- a/build.rs +++ b/build.rs @@ -15,9 +15,9 @@ fn get_git_sha() -> Option { let symbolic = cmd(&["git", "rev-parse", "--symbolic", "HEAD"]).unwrap(); let symbolic_full = cmd(&["git", "rev-parse", "--symbolic-full-name", "HEAD"]).unwrap(); - println!("cargo:rerun-if-changed=.git/{}", symbolic); + println!("cargo:rerun-if-changed=.git/{symbolic}"); if symbolic != symbolic_full { - println!("cargo:rerun-if-changed=.git/{}", symbolic_full); + println!("cargo:rerun-if-changed=.git/{symbolic_full}"); } Some(sha) @@ -31,5 +31,5 @@ fn main() { let sha = format!("{:?}", get_git_sha()); let output = std::env::var("OUT_DIR").unwrap(); - ::std::fs::write(format!("{}/sha", output), sha.as_bytes()).unwrap(); + ::std::fs::write(format!("{output}/sha"), sha.as_bytes()).unwrap(); } diff --git a/src/actions/experiments/edit.rs b/src/actions/experiments/edit.rs index b070caec6..c48be6d95 100644 --- a/src/actions/experiments/edit.rs +++ b/src/actions/experiments/edit.rs @@ -57,7 +57,7 @@ impl Action for EditExperiment { } let changes = t.execute( - &format!("UPDATE experiments SET {} = ?1 WHERE name = ?2;", col), + &format!("UPDATE experiments SET {col} = ?1 WHERE name = ?2;"), &[&ex.toolchains[i].to_string(), &self.name], )?; assert_eq!(changes, 1); diff --git a/src/agent/api.rs b/src/agent/api.rs index ab53298f5..2368fd396 100644 --- a/src/agent/api.rs +++ b/src/agent/api.rs @@ -51,7 +51,7 @@ impl ResponseExt for ::reqwest::blocking::Response { let status = self.status(); let result: ApiResponse = self .json() - .with_context(|_| format!("failed to parse API response (status code {})", status,))?; + .with_context(|_| format!("failed to parse API response (status code {status})",))?; match result { ApiResponse::Success { result } => Ok(result), ApiResponse::SlowDown => Err(AgentApiError::ServerUnavailable.into()), @@ -78,7 +78,7 @@ impl AgentApi { } fn build_request(&self, method: Method, url: &str) -> RequestBuilder { - utils::http::prepare_sync(method, &format!("{}/agent-api/{}", self.url, url)).header( + utils::http::prepare_sync(method, &format!("{}/agent-api/{url}", self.url)).header( AUTHORIZATION, (CraterToken { token: self.token.clone(), @@ -101,7 +101,7 @@ impl AgentApi { // We retry these errors. Ideally it's something the // server would handle, but that's (unfortunately) hard // in practice. - format!("{:?}", err).contains("database is locked") + format!("{err:?}").contains("database is locked") }; if retry { diff --git a/src/crates/mod.rs b/src/crates/mod.rs index 6dcbe5dc4..5203bcc57 100644 --- a/src/crates/mod.rs +++ b/src/crates/mod.rs @@ -35,12 +35,12 @@ impl Crate { Crate::Registry(ref details) => format!("reg/{}/{}", details.name, details.version), Crate::GitHub(ref repo) => { if let Some(ref sha) = repo.sha { - format!("gh/{}/{}/{}", repo.org, repo.name, sha) + format!("gh/{}/{}/{sha}", repo.org, repo.name) } else { format!("gh/{}/{}", repo.org, repo.name) } } - Crate::Local(ref name) => format!("local/{}", name), + Crate::Local(ref name) => format!("local/{name}"), Crate::Path(ref path) => { format!("path/{}", utf8_percent_encode(path, NON_ALPHANUMERIC)) } @@ -132,11 +132,11 @@ impl fmt::Display for Crate { Crate::Registry(ref krate) => format!("{}-{}", krate.name, krate.version), Crate::GitHub(ref repo) => if let Some(ref sha) = repo.sha { - format!("{}/{}/{}", repo.org, repo.name, sha) + format!("{}/{}/{sha}", repo.org, repo.name) } else { format!("{}/{}", repo.org, repo.name) }, - Crate::Local(ref name) => format!("{} (local)", name), + Crate::Local(ref name) => format!("{name} (local)"), Crate::Path(ref path) => format!("{}", utf8_percent_encode(path, NON_ALPHANUMERIC)), Crate::Git(ref repo) => if let Some(ref sha) = repo.sha { diff --git a/src/db/migrations.rs b/src/db/migrations.rs index 7e9cd6465..9a914e7fe 100644 --- a/src/db/migrations.rs +++ b/src/db/migrations.rs @@ -153,8 +153,8 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> { if let Ok(parsed) = serde_json::from_str(&legacy) { Ok(match parsed { LegacyToolchain::Dist(name) => name, - LegacyToolchain::TryBuild { sha } => format!("try#{}", sha), - LegacyToolchain::Master { sha } => format!("master#{}", sha), + LegacyToolchain::TryBuild { sha } => format!("try#{sha}"), + LegacyToolchain::Master { sha } => format!("master#{sha}"), }) } else { Ok(legacy) @@ -178,7 +178,7 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> { [], )?; t.execute( - &format!("UPDATE results SET toolchain = {}(toolchain);", fn_name), + &format!("UPDATE results SET toolchain = {fn_name}(toolchain);"), [], )?; t.execute("PRAGMA foreign_keys = ON;", [])?; @@ -352,15 +352,15 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> { t.execute("PRAGMA foreign_keys = OFF;", [])?; t.execute( - &format!("UPDATE experiment_crates SET crate = {}(crate);", fn_name), + &format!("UPDATE experiment_crates SET crate = {fn_name}(crate);"), [], )?; t.execute( - &format!("UPDATE results SET crate = {}(crate);", fn_name), + &format!("UPDATE results SET crate = {fn_name}(crate);"), [], )?; t.execute( - &format!("UPDATE crates SET crate = {}(crate);", fn_name), + &format!("UPDATE crates SET crate = {fn_name}(crate);"), [], )?; t.execute("PRAGMA foreign_keys = ON;", [])?; @@ -406,7 +406,7 @@ pub fn execute(db: &mut Connection) -> Fallible<()> { MigrationKind::SQL(sql) => t.execute_batch(sql), MigrationKind::Code(code) => code(&t), } - .with_context(|_| format!("error running migration: {}", name))?; + .with_context(|_| format!("error running migration: {name}"))?; t.execute("INSERT INTO migrations (name) VALUES (?1)", [&name])?; t.commit()?; diff --git a/src/experiments.rs b/src/experiments.rs index 86c5bd08e..44af016eb 100644 --- a/src/experiments.rs +++ b/src/experiments.rs @@ -97,9 +97,9 @@ impl fmt::Display for CrateSelect { CrateSelect::Full => write!(f, "full"), CrateSelect::Demo => write!(f, "demo"), CrateSelect::Dummy => write!(f, "dummy"), - CrateSelect::Top(n) => write!(f, "top-{}", n), + CrateSelect::Top(n) => write!(f, "top-{n}"), CrateSelect::Local => write!(f, "local"), - CrateSelect::Random(n) => write!(f, "random-{}", n), + CrateSelect::Random(n) => write!(f, "random-{n}"), CrateSelect::List(list) => { let mut first = true; write!(f, "list:")?; @@ -109,7 +109,7 @@ impl fmt::Display for CrateSelect { write!(f, ",")?; } - write!(f, "{}", krate)?; + write!(f, "{krate}")?; first = false; } @@ -178,7 +178,7 @@ pub enum Assignee { impl fmt::Display for Assignee { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Assignee::Agent(ref name) => write!(f, "agent:{}", name), + Assignee::Agent(ref name) => write!(f, "agent:{name}"), Assignee::Distributed => write!(f, "distributed"), Assignee::CLI => write!(f, "cli"), } diff --git a/src/report/archives.rs b/src/report/archives.rs index 36ecbeab2..c27cac952 100644 --- a/src/report/archives.rs +++ b/src/report/archives.rs @@ -50,7 +50,7 @@ fn iterate<'a, DB: ReadResults + 'a>( let log = db .load_log(ex, tc, krate) .and_then(|c| c.ok_or_else(|| err_msg("missing logs"))) - .with_context(|_| format!("failed to read log of {} on {}", krate, tc)); + .with_context(|_| format!("failed to read log of {krate} on {tc}")); let log_bytes: EncodedLog = match log { Ok(l) => l, @@ -163,15 +163,15 @@ pub fn write_logs_archives( for (comparison, archive) in by_comparison.drain(..) { let data = archive.into_inner()?.finish()?; dest.write_bytes( - format!("logs-archives/{}.tar.gz", comparison), + format!("logs-archives/{comparison}.tar.gz"), data, &"application/gzip".parse().unwrap(), EncodingType::Plain, )?; archives.push(Archive { - name: format!("{} crates", comparison), - path: format!("logs-archives/{}.tar.gz", comparison), + name: format!("{comparison} crates"), + path: format!("logs-archives/{comparison}.tar.gz"), }); } diff --git a/src/report/markdown.rs b/src/report/markdown.rs index 8e9ffa9fa..dada5da61 100644 --- a/src/report/markdown.rs +++ b/src/report/markdown.rs @@ -66,7 +66,7 @@ fn write_crate( let prefix = if is_child { " * " } else { "* " }; let status_warning = krate .status - .map(|status| format!(" ({})", status)) + .map(|status| format!(" ({status})")) .unwrap_or_default(); if let ReportConfig::Complete(toolchain) = comparison.report_config() { @@ -106,7 +106,7 @@ fn render_markdown(context: &ResultsContext) -> Fallible { writeln!(rendered, "# Crater report for {}\n\n", context.ex.name)?; for (comparison, results) in context.categories.iter() { - writeln!(rendered, "\n### {}", comparison)?; + writeln!(rendered, "\n### {comparison}")?; match results { ReportCratesMD::Plain(crates) => { for krate in crates { diff --git a/src/report/mod.rs b/src/report/mod.rs index 56f8686d7..edb3c1c4f 100644 --- a/src/report/mod.rs +++ b/src/report/mod.rs @@ -293,7 +293,7 @@ fn write_logs( let content = db .load_log(ex, tc, krate) .and_then(|c| c.ok_or_else(|| err_msg("missing logs"))) - .with_context(|_| format!("failed to read log of {} on {}", krate, tc)); + .with_context(|_| format!("failed to read log of {krate} on {tc}")); let content = match content { Ok(c) => c, Err(e) => { @@ -392,12 +392,12 @@ fn crate_to_name(c: &Crate) -> String { Crate::Registry(ref details) => format!("{}-{}", details.name, details.version), Crate::GitHub(ref repo) => { if let Some(ref sha) = repo.sha { - format!("{}.{}.{}", repo.org, repo.name, sha) + format!("{}.{}.{sha}", repo.org, repo.name) } else { format!("{}.{}", repo.org, repo.name) } } - Crate::Local(ref name) => format!("{} (local)", name), + Crate::Local(ref name) => format!("{name} (local)"), Crate::Path(ref path) => utf8_percent_encode(path, &REPORT_ENCODE_SET).to_string(), Crate::Git(ref repo) => { if let Some(ref sha) = repo.sha { @@ -421,7 +421,7 @@ fn crate_to_url(c: &Crate) -> String { ), Crate::GitHub(ref repo) => { if let Some(ref sha) = repo.sha { - format!("https://github.com/{}/{}/tree/{}", repo.org, repo.name, sha) + format!("https://github.com/{}/{}/tree/{sha}", repo.org, repo.name) } else { format!("https://github.com/{}/{}", repo.org, repo.name) } @@ -499,7 +499,7 @@ fn compare( | (TestPass, TestSkipped) | (TestSkipped, TestFail(_)) | (TestSkipped, TestPass) => { - panic!("can't compare {} and {}", res1, res2); + panic!("can't compare {res1} and {res2}"); } }, _ if config.should_skip(krate) => Comparison::Skipped, diff --git a/src/report/s3.rs b/src/report/s3.rs index 92c3134a6..33f6c8eff 100644 --- a/src/report/s3.rs +++ b/src/report/s3.rs @@ -229,7 +229,7 @@ mod tests { "s3://bucket:80", "s3://bucket/path/prefix?query#fragment", ] { - assert!(S3Prefix::from_str(bad).is_err(), "valid bad url: {}", bad); + assert!(S3Prefix::from_str(bad).is_err(), "valid bad url: {bad}"); } } } diff --git a/src/runner/mod.rs b/src/runner/mod.rs index db77ea4f1..efe450539 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -111,7 +111,7 @@ pub fn run_ex( let workers = (0..threads_count) .map(|i| { Worker::new( - format!("worker-{}", i), + format!("worker-{i}"), workspace, ex, config, diff --git a/src/runner/tasks.rs b/src/runner/tasks.rs index 75a6bbae8..ce5ecb116 100644 --- a/src/runner/tasks.rs +++ b/src/runner/tasks.rs @@ -74,9 +74,9 @@ impl fmt::Debug for TaskStep { TaskStep::UnstableFeatures { ref tc } => ("find unstable features on", false, Some(tc)), }; - write!(f, "{}", name)?; + write!(f, "{name}")?; if let Some(tc) = tc { - write!(f, " {}", tc)?; + write!(f, " {tc}")?; } if quiet { write!(f, " (quiet)")?; diff --git a/src/server/auth.rs b/src/server/auth.rs index d53bdcd91..dd00c9a04 100644 --- a/src/server/auth.rs +++ b/src/server/auth.rs @@ -168,7 +168,7 @@ impl ACL { let members = github.team_members( *orgs[org] .get(team) - .ok_or_else(|| err_msg(format!("team {}/{} doesn't exist", org, team)))?, + .ok_or_else(|| err_msg(format!("team {org}/{team} doesn't exist")))?, )?; for member in &members { new_cache.insert(member.clone()); @@ -206,11 +206,11 @@ mod tests { fn test_git_revision() { for sha in &["0000000", "0000000000000000000000000000000000000000"] { assert_eq!( - git_revision(&format!("crater/{}", sha)), + git_revision(&format!("crater/{sha}")), Some(sha.to_string()) ); assert_eq!( - git_revision(&format!("crater/{} (foo bar!)", sha)), + git_revision(&format!("crater/{sha} (foo bar!)")), Some(sha.to_string()) ); } diff --git a/src/server/github.rs b/src/server/github.rs index 3ee0529ff..ebeed7334 100644 --- a/src/server/github.rs +++ b/src/server/github.rs @@ -39,7 +39,7 @@ impl GitHubApi { fn build_request(&self, method: Method, url: &str) -> RequestBuilder { let url = if !url.starts_with("https://") { - format!("https://api.github.com/{}", url) + format!("https://api.github.com/{url}") } else { url.to_string() }; @@ -57,7 +57,7 @@ impl GitHub for GitHubApi { fn post_comment(&self, issue_url: &str, body: &str) -> Fallible<()> { let response = self - .build_request(Method::POST, &format!("{}/comments", issue_url)) + .build_request(Method::POST, &format!("{issue_url}/comments")) .json(&json!({ "body": body, })) @@ -74,7 +74,7 @@ impl GitHub for GitHubApi { fn list_labels(&self, issue_url: &str) -> Fallible> { let response = self - .build_request(Method::GET, &format!("{}/labels", issue_url)) + .build_request(Method::GET, &format!("{issue_url}/labels")) .send()?; let status = response.status(); @@ -88,7 +88,7 @@ impl GitHub for GitHubApi { fn add_label(&self, issue_url: &str, label: &str) -> Fallible<()> { let response = self - .build_request(Method::POST, &format!("{}/labels", issue_url)) + .build_request(Method::POST, &format!("{issue_url}/labels")) .json(&json!([label])) .send()?; @@ -103,7 +103,7 @@ impl GitHub for GitHubApi { fn remove_label(&self, issue_url: &str, label: &str) -> Fallible<()> { let response = self - .build_request(Method::DELETE, &format!("{}/labels/{}", issue_url, label)) + .build_request(Method::DELETE, &format!("{issue_url}/labels/{label}")) .send()?; let status = response.status(); @@ -117,7 +117,7 @@ impl GitHub for GitHubApi { fn list_teams(&self, org: &str) -> Fallible> { let response = self - .build_request(Method::GET, &format!("orgs/{}/teams", org)) + .build_request(Method::GET, &format!("orgs/{org}/teams")) .send()?; let status = response.status(); @@ -132,7 +132,7 @@ impl GitHub for GitHubApi { fn team_members(&self, team: usize) -> Fallible> { let response = self - .build_request(Method::GET, &format!("teams/{}/members", team)) + .build_request(Method::GET, &format!("teams/{team}/members")) .send()?; let status = response.status(); @@ -147,7 +147,7 @@ impl GitHub for GitHubApi { fn get_commit(&self, repo: &str, sha: &str) -> Fallible { let commit = self - .build_request(Method::GET, &format!("repos/{}/commits/{}", repo, sha)) + .build_request(Method::GET, &format!("repos/{repo}/commits/{sha}")) .send()? .error_for_status()? .json()?; @@ -156,7 +156,7 @@ impl GitHub for GitHubApi { fn get_pr_head_sha(&self, repo: &str, pr: i32) -> Fallible { let pr: PullRequestData = self - .build_request(Method::GET, &format!("repos/{}/pulls/{}", repo, pr)) + .build_request(Method::GET, &format!("repos/{repo}/pulls/{pr}")) .send()? .error_for_status()? .json()?; diff --git a/src/server/reports.rs b/src/server/reports.rs index f50eaa109..6ea3a78f3 100644 --- a/src/server/reports.rs +++ b/src/server/reports.rs @@ -80,7 +80,7 @@ fn reports_thread(data: &Data, github_data: Option<&GithubData>) -> Fallible<()> Message::new() .line( "rotating_light", - format!("Report generation of **`{}`** failed: {}", name, err), + format!("Report generation of **`{name}`** failed: {err}"), ) .line( "hammer_and_wrench", @@ -102,7 +102,7 @@ fn reports_thread(data: &Data, github_data: Option<&GithubData>) -> Fallible<()> .reports_bucket .public_url .replace("{bucket}", &data.tokens.reports_bucket.bucket); - let report_url = format!("{}/{}/index.html", base_url, name); + let report_url = format!("{base_url}/{name}/index.html"); ex.set_status(&data.db, Status::Completed)?; ex.set_report_url(&data.db, &report_url)?; @@ -116,7 +116,7 @@ fn reports_thread(data: &Data, github_data: Option<&GithubData>) -> Fallible<()> if let Some(github_data) = github_data { if let Some(ref github_issue) = ex.github_issue { Message::new() - .line("tada", format!("Experiment **`{}`** is completed!", name)) + .line("tada", format!("Experiment **`{name}`** is completed!")) .line( "bar_chart", format!( @@ -128,7 +128,7 @@ fn reports_thread(data: &Data, github_data: Option<&GithubData>) -> Fallible<()> ) .line( "newspaper", - format!("[Open the full report]({}).", report_url), + format!("[Open the full report]({report_url})."), ) .note( "warning", diff --git a/src/server/routes/metrics.rs b/src/server/routes/metrics.rs index 27b4e251f..bbc70087a 100644 --- a/src/server/routes/metrics.rs +++ b/src/server/routes/metrics.rs @@ -21,7 +21,7 @@ pub fn routes( error!("error while processing metrics"); crate::utils::report_failure(&err); - let mut resp = Response::new(format!("Error: {}\n", err).into()); + let mut resp = Response::new(format!("Error: {err}\n").into()); *resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; resp } diff --git a/src/server/routes/ui/experiments.rs b/src/server/routes/ui/experiments.rs index ef319d795..acace9276 100644 --- a/src/server/routes/ui/experiments.rs +++ b/src/server/routes/ui/experiments.rs @@ -129,7 +129,7 @@ struct ExperimentContext { fn humanize(duration: Duration) -> String { let duration = duration.to_std().expect("non-negative duration"); if duration.as_secs() < 60 { - format!("{:?}", duration) + format!("{duration:?}") } else if duration.as_secs() < 60 * 60 { format!("{} minutes", duration.as_secs() / 60) } else { diff --git a/src/server/routes/webhooks/commands.rs b/src/server/routes/webhooks/commands.rs index a545771e7..f85e0f95e 100644 --- a/src/server/routes/webhooks/commands.rs +++ b/src/server/routes/webhooks/commands.rs @@ -60,7 +60,7 @@ pub fn run( let mut message = Message::new().line( "ok_hand", - format!("Experiment **`{}`** created and queued.", name), + format!("Experiment **`{name}`** created and queued."), ); // Autodetect toolchains only if none of them was specified @@ -156,7 +156,7 @@ pub fn run( .line( "mag", format!( - "You can check out [the queue](https://{}) and [this experiment's details](https://{0}/ex/{1}).", host, name + "You can check out [the queue](https://{host}) and [this experiment's details](https://{host}/ex/{name})." ), ).set_label(Label::ExperimentQueued) .send(&issue.url, data,github_data)?; @@ -189,7 +189,7 @@ pub fn edit(data: &Data, github_data: &GithubData, issue: &Issue, args: EditArgs Message::new() .line( "memo", - format!("Configuration of the **`{}`** experiment changed.", name), + format!("Configuration of the **`{name}`** experiment changed."), ) .send(&issue.url, data, github_data)?; @@ -220,7 +220,7 @@ pub fn retry_report( Message::new() .line( "hammer_and_wrench", - format!("Generation of the report for **`{}`** queued again.", name), + format!("Generation of the report for **`{name}`** queued again."), ) .set_label(Label::ExperimentQueued) .send(&issue.url, data, github_data)?; @@ -246,7 +246,7 @@ pub fn retry( Message::new() .line( "hammer_and_wrench", - format!("Experiment **`{}`** queued again.", name), + format!("Experiment **`{name}`** queued again."), ) .set_label(Label::ExperimentQueued) .send(&issue.url, data, github_data)?; @@ -269,7 +269,7 @@ pub fn abort( .apply(&ActionsCtx::new(&data.db, &data.config))?; Message::new() - .line("wastebasket", format!("Experiment **`{}`** deleted!", name)) + .line("wastebasket", format!("Experiment **`{name}`** deleted!")) .set_label(Label::ExperimentCompleted) .send(&issue.url, data, github_data)?; @@ -343,7 +343,7 @@ fn generate_new_experiment_name(db: &Database, issue: &Issue) -> Fallible Fallible { let content = ::std::fs::read_to_string(Path::new(TOKENS_PATH)) - .with_context(|_| format!("could not find {}", TOKENS_PATH))?; + .with_context(|_| format!("could not find {TOKENS_PATH}"))?; let res = ::toml::from_str(&content)?; Ok(res) } diff --git a/src/toolchain.rs b/src/toolchain.rs index 57eb08a04..1ad7cd0dc 100644 --- a/src/toolchain.rs +++ b/src/toolchain.rs @@ -71,23 +71,23 @@ impl fmt::Display for Toolchain { } if let Some(ref target) = self.target { - write!(f, "+target={}", target)?; + write!(f, "+target={target}")?; } if let Some(ref flag) = self.rustflags { - write!(f, "+rustflags={}", flag)?; + write!(f, "+rustflags={flag}")?; } if let Some(ref flag) = self.rustdocflags { - write!(f, "+rustdocflags={}", flag)?; + write!(f, "+rustdocflags={flag}")?; } if let Some(ref flag) = self.cargoflags { - write!(f, "+cargoflags={}", flag)?; + write!(f, "+cargoflags={flag}")?; } for patch in self.patches.iter() { - write!(f, "+patch={}", patch)?; + write!(f, "+patch={patch}")?; } Ok(()) diff --git a/src/utils/size.rs b/src/utils/size.rs index 49c8ff785..1d5a3c6fd 100644 --- a/src/utils/size.rs +++ b/src/utils/size.rs @@ -29,11 +29,11 @@ impl Size { impl fmt::Display for Size { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Size::Bytes(count) => write!(f, "{}", count), - Size::Kilobytes(count) => write!(f, "{}K", count), - Size::Megabytes(count) => write!(f, "{}M", count), - Size::Gigabytes(count) => write!(f, "{}G", count), - Size::Terabytes(count) => write!(f, "{}T", count), + Size::Bytes(count) => write!(f, "{count}"), + Size::Kilobytes(count) => write!(f, "{count}K"), + Size::Megabytes(count) => write!(f, "{count}M"), + Size::Gigabytes(count) => write!(f, "{count}G"), + Size::Terabytes(count) => write!(f, "{count}T"), } } } diff --git a/tests/common/cli_utils.rs b/tests/common/cli_utils.rs index f99a612ce..541840bc1 100644 --- a/tests/common/cli_utils.rs +++ b/tests/common/cli_utils.rs @@ -25,6 +25,6 @@ pub(crate) trait CommandCraterExt { impl CommandCraterExt for Command { fn crater() -> Self { - Command::new(bin_path().join(format!("{}{}", CRATER_BIN_NAME, EXE_SUFFIX))) + Command::new(bin_path().join(format!("{CRATER_BIN_NAME}{EXE_SUFFIX}"))) } } diff --git a/tests/minicrater/driver.rs b/tests/minicrater/driver.rs index 09c83918d..22578998f 100644 --- a/tests/minicrater/driver.rs +++ b/tests/minicrater/driver.rs @@ -60,7 +60,7 @@ trait Compare { let expected_file = ex_dir.join(expand_file_names(file, ".expected")); // Load actual report let raw_report = ::std::fs::read(file_dir.join(file)) - .unwrap_or_else(|_| panic!("failed to read {}", file)); + .unwrap_or_else(|_| panic!("failed to read {file}")); // Test report format let actual_report = self.format(raw_report);