diff --git a/Cargo.toml b/Cargo.toml index 02093f3d4..a1a49b952 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,7 @@ [package] name = "crater" version = "0.1.0" -authors = [ - "Brian Anderson ", - "Pietro Albini ", -] -edition = "2018" +edition = "2021" build = "build.rs" 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/config.toml b/config.toml index d76b250fd..5ab212880 100644 --- a/config.toml +++ b/config.toml @@ -149,6 +149,11 @@ crokey = { skip-tests = true } # compiler error checks in tests "wischli/rpaillier" = { skip-tests = true } # flaky tests "AntonChernev/suffix-tree-search" = { skip-tests = true } # flaky tests "0xpr03/yayd" = { skip-tests = true } # network in tests +"gclark916/vulkano_examples" = { skip = true } # spurious proc macro error +"gclark916/vulkano_tri1" = { skip = true } # spurious proc macro error +"Ayrx/binja-rs-hello-world" = { skip = true } # shared directory messed up by first build +"Ninja3047/load-symbols" = { skip = true } # shared directory messed up by first build +"etke/bff" = { skip = true } # shared directory messed up by first build "APTy/icmp" = { skip-tests = true } # network in tests "GothAck/rs-async-debug" = { skip-tests = true } # compiler error checks in tests "hank-der-hafenarbeiter/imperative-rs" = { skip-tests = true } # compiler error checks in tests diff --git a/local-crates/beta-faulty-deps/Cargo.toml b/local-crates/beta-faulty-deps/Cargo.toml index 24854ee24..ffdcafa82 100644 --- a/local-crates/beta-faulty-deps/Cargo.toml +++ b/local-crates/beta-faulty-deps/Cargo.toml @@ -1,8 +1,7 @@ [package] name = "beta-faulty-deps" version = "0.1.0" -authors = ["Giacomo Pasini "] -edition = "2018" +edition = "2021" [dependencies] error_code = {git = "https://github.com/rust-lang/crater", rev = "f190933e896443e285e3bb6962fb87d7439b8d65"} diff --git a/local-crates/clippy-warn/Cargo.toml b/local-crates/clippy-warn/Cargo.toml index 6e9726b87..c5bf7ce72 100644 --- a/local-crates/clippy-warn/Cargo.toml +++ b/local-crates/clippy-warn/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "clippy-warn" version = "0.1.0" -authors = ["Dylan MacKenzie "] -edition = "2018" +edition = "2021" [dependencies] diff --git a/local-crates/docs-rs-features/Cargo.toml b/local-crates/docs-rs-features/Cargo.toml index b9ff60158..746f5a8ae 100644 --- a/local-crates/docs-rs-features/Cargo.toml +++ b/local-crates/docs-rs-features/Cargo.toml @@ -1,8 +1,7 @@ [package] name = "docs-rs-features" version = "0.1.0" -authors = ["Joshua Nelson "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/local-crates/error-code/Cargo.toml b/local-crates/error-code/Cargo.toml index e0d597c53..202fdc6a2 100644 --- a/local-crates/error-code/Cargo.toml +++ b/local-crates/error-code/Cargo.toml @@ -1,8 +1,7 @@ [package] name = "error_code" version = "0.1.0" -authors = ["Giacomo Pasini "] -edition = "2018" +edition = "2021" [dependencies] diff --git a/local-crates/faulty-deps/Cargo.toml b/local-crates/faulty-deps/Cargo.toml index f9765e316..d0d03dc54 100644 --- a/local-crates/faulty-deps/Cargo.toml +++ b/local-crates/faulty-deps/Cargo.toml @@ -1,8 +1,7 @@ [package] name = "faulty-deps" version = "0.1.0" -authors = ["Giacomo Pasini "] -edition = "2018" +edition = "2021" [dependencies] error_code = {git = "https://github.com/rust-lang/crater", rev = "c3f462bdab37a93c24b2b172b90564749e892cbc"} diff --git a/local-crates/outdated-lockfile/Cargo.toml b/local-crates/outdated-lockfile/Cargo.toml index 9b0a7d06d..c6e8ed0dd 100644 --- a/local-crates/outdated-lockfile/Cargo.toml +++ b/local-crates/outdated-lockfile/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "outdated-lockfile" version = "0.1.0" -authors = ["Pietro Albini "] -edition = "2018" +edition = "2021" [dependencies] diff --git a/local-crates/yanked-deps/Cargo.toml b/local-crates/yanked-deps/Cargo.toml index d6d4bf664..25b829440 100644 --- a/local-crates/yanked-deps/Cargo.toml +++ b/local-crates/yanked-deps/Cargo.toml @@ -1,8 +1,7 @@ [package] name = "yanked-deps" version = "0.1.0" -authors = ["Pietro Albini "] -edition = "2018" +edition = "2021" [dependencies] ring = "0.2" diff --git a/src/actions/experiments/create.rs b/src/actions/experiments/create.rs index 9eff43e34..21fbba07c 100644 --- a/src/actions/experiments/create.rs +++ b/src/actions/experiments/create.rs @@ -185,7 +185,7 @@ mod tests { let crates: Vec = db .query( "SELECT crate FROM experiment_crates WHERE experiment = ?1 AND skipped = 0", - &[&ex], + [&ex], |row| { let krate: String = row.get("crate")?; Ok(krate.parse().unwrap()) diff --git a/src/actions/experiments/edit.rs b/src/actions/experiments/edit.rs index 9b3f21dd2..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); @@ -251,7 +251,7 @@ mod tests { let crates: Vec = db .query( "SELECT crate FROM experiment_crates WHERE experiment = ?1 AND skipped = 0", - &[&ex], + [&ex], |row| { let krate: String = row.get("crate")?; Ok(krate.parse().unwrap()) 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..fe75a5073 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,17 +352,11 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> { t.execute("PRAGMA foreign_keys = OFF;", [])?; t.execute( - &format!("UPDATE experiment_crates SET crate = {}(crate);", fn_name), - [], - )?; - t.execute( - &format!("UPDATE results SET crate = {}(crate);", fn_name), - [], - )?; - t.execute( - &format!("UPDATE crates SET crate = {}(crate);", fn_name), + &format!("UPDATE experiment_crates SET crate = {fn_name}(crate);"), [], )?; + t.execute(&format!("UPDATE results SET crate = {fn_name}(crate);"), [])?; + t.execute(&format!("UPDATE crates SET crate = {fn_name}(crate);"), [])?; t.execute("PRAGMA foreign_keys = ON;", [])?; Ok(()) @@ -406,7 +400,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 500f67351..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/html.rs b/src/report/html.rs index 3446077e2..c8d7d7f25 100644 --- a/src/report/html.rs +++ b/src/report/html.rs @@ -123,7 +123,7 @@ fn write_report( result_names.len() - 1 }); runs[pos] = Some(BuildTestResultHTML { - res: *idx as usize, + res: *idx, log: run.log.clone(), }); } 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 43d5a8df5..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, @@ -542,13 +542,13 @@ impl ReportWriter for FileWriter { _: EncodingType, ) -> Fallible<()> { self.create_prefix(path.as_ref())?; - fs::write(&self.0.join(path.as_ref()), &b)?; + fs::write(self.0.join(path.as_ref()), b)?; Ok(()) } fn write_string>(&self, path: P, s: Cow, _: &Mime) -> Fallible<()> { self.create_prefix(path.as_ref())?; - fs::write(&self.0.join(path.as_ref()), s.as_ref().as_bytes())?; + fs::write(self.0.join(path.as_ref()), s.as_ref().as_bytes())?; Ok(()) } } @@ -973,19 +973,19 @@ mod tests { ); assert_eq!(gh_result.res, Comparison::Regressed); assert_eq!( - (&gh_result.runs[0]).as_ref().unwrap().res, + gh_result.runs[0].as_ref().unwrap().res, TestResult::TestPass ); assert_eq!( - (&gh_result.runs[1]).as_ref().unwrap().res, + gh_result.runs[1].as_ref().unwrap().res, TestResult::BuildFail(FailureReason::Unknown) ); assert_eq!( - Path::new((&gh_result.runs[0]).as_ref().unwrap().log.as_str()), + Path::new(gh_result.runs[0].as_ref().unwrap().log.as_str()), Path::new("stable/gh/brson.hello-rs") ); assert_eq!( - Path::new((&gh_result.runs[1]).as_ref().unwrap().log.as_str()), + Path::new(gh_result.runs[1].as_ref().unwrap().log.as_str()), Path::new("beta/gh/brson.hello-rs") ); @@ -996,19 +996,19 @@ mod tests { ); assert_eq!(reg_result.res, Comparison::Regressed); assert_eq!( - (®_result.runs[0]).as_ref().unwrap().res, + reg_result.runs[0].as_ref().unwrap().res, TestResult::TestPass ); assert_eq!( - (®_result.runs[1]).as_ref().unwrap().res, + reg_result.runs[1].as_ref().unwrap().res, TestResult::BuildFail(FailureReason::Unknown) ); assert_eq!( - Path::new((®_result.runs[0]).as_ref().unwrap().log.as_str()), + Path::new(reg_result.runs[0].as_ref().unwrap().log.as_str()), Path::new("stable/reg/syn-1.0.0") ); assert_eq!( - Path::new((®_result.runs[1]).as_ref().unwrap().log.as_str()), + Path::new(reg_result.runs[1].as_ref().unwrap().log.as_str()), Path::new("beta/reg/syn-1.0.0") ); 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/runner/test.rs b/src/runner/test.rs index 86c6212e4..4c60863cb 100644 --- a/src/runner/test.rs +++ b/src/runner/test.rs @@ -386,7 +386,7 @@ pub(super) fn test_rustdoc( // Make sure to remove the built documentation // There is no point in storing it after the build is done - remove_dir_all(&build_env.host_target_dir().join("doc"))?; + remove_dir_all(build_env.host_target_dir().join("doc"))?; res }; diff --git a/src/server/agents.rs b/src/server/agents.rs index 16f952b43..7d687e265 100644 --- a/src/server/agents.rs +++ b/src/server/agents.rs @@ -135,7 +135,7 @@ impl Agents { #[cfg(test)] fn get(&self, name: &str) -> Fallible> { self.db - .get_row("SELECT * FROM agents WHERE name = ?1;", &[&name], |row| { + .get_row("SELECT * FROM agents WHERE name = ?1;", [&name], |row| { Ok(Agent { name: row.get("name")?, last_heartbeat: row.get("last_heartbeat")?, 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/check_config/mod.rs b/tests/check_config/mod.rs index c66055bff..361b43974 100644 --- a/tests/check_config/mod.rs +++ b/tests/check_config/mod.rs @@ -6,7 +6,7 @@ use std::process::Command; #[test] fn test_good_config() { Command::crater() - .args(&["check-config", "tests/check_config/good.toml"]) + .args(["check-config", "tests/check_config/good.toml"]) .assert() .success(); } @@ -14,7 +14,7 @@ fn test_good_config() { #[test] fn test_bad_config_duplicate_crate() { Command::crater() - .args(&[ + .args([ "check-config", "tests/check_config/bad-duplicate-crate.toml", ]) @@ -27,7 +27,7 @@ fn test_bad_config_duplicate_crate() { #[test] fn test_bad_config_duplicate_repo() { Command::crater() - .args(&["check-config", "tests/check_config/bad-duplicate-repo.toml"]) + .args(["check-config", "tests/check_config/bad-duplicate-repo.toml"]) .assert() .failure() .code(1) @@ -39,7 +39,7 @@ fn test_bad_config_duplicate_repo() { #[test] fn test_bad_config_missing_crate() { Command::crater() - .args(&["check-config", "tests/check_config/bad-missing-crate.toml"]) + .args(["check-config", "tests/check_config/bad-missing-crate.toml"]) .assert() .failure() .code(1) @@ -49,7 +49,7 @@ fn test_bad_config_missing_crate() { #[test] fn test_bad_config_missing_repo() { Command::crater() - .args(&["check-config", "tests/check_config/bad-missing-repo.toml"]) + .args(["check-config", "tests/check_config/bad-missing-repo.toml"]) .assert() .failure() .code(1) 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 c7160f66e..9fed0851f 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); @@ -153,7 +153,7 @@ impl MinicraterRun { // Create local list in the temp work dir Command::crater() - .args(&["create-lists", "local"]) + .args(["create-lists", "local"]) .env("CRATER_CONFIG", &config_file) .minicrater_exec(); @@ -171,8 +171,10 @@ impl MinicraterRun { .minicrater_exec(); // Execute the experiment + #[allow(clippy::needless_borrow)] + // https://github.com/rust-lang/rust-clippy/issues/9739 Command::crater() - .args(&[ + .args([ "run-graph", &ex_arg, "--threads", @@ -189,7 +191,7 @@ impl MinicraterRun { let mut failed = false; Command::crater() - .args(&["gen-report", &ex_arg]) + .args(["gen-report", &ex_arg]) .env("CRATER_CONFIG", &config_file) .arg(report_dir.path()) .arg("--output-templates") @@ -201,7 +203,7 @@ impl MinicraterRun { // Delete the experiment Command::crater() - .args(&["delete-ex", &ex_arg]) + .args(["delete-ex", &ex_arg]) .env("CRATER_CONFIG", &config_file) .minicrater_exec();