diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57e5ce37c..eb0fb6b76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: push: branches: - master - pull_request: {} + pull_request: { } schedule: - cron: "0 12 * * 1" # Every Monday at 12:00 UTC @@ -26,7 +26,7 @@ jobs: rustup default $RUST_TOOLCHAIN_VERSION rustup component add --toolchain $RUST_TOOLCHAIN_VERSION rustfmt clippy env: - RUST_TOOLCHAIN_VERSION: 1.75.0 + RUST_TOOLCHAIN_VERSION: 1.81.0 - uses: Swatinem/rust-cache@v2 with: diff --git a/collector/Cargo.toml b/collector/Cargo.toml index 11795de0d..efb87fd0f 100644 --- a/collector/Cargo.toml +++ b/collector/Cargo.toml @@ -4,7 +4,7 @@ name = "collector" version = "0.1.0" edition = "2021" description = "Collects Rust performance data" -rust-version = "1.75.0" +rust-version = "1.81.0" [dependencies] anyhow = { workspace = true } diff --git a/collector/src/artifact_stats.rs b/collector/src/artifact_stats.rs index ece44bf90..9688e8109 100644 --- a/collector/src/artifact_stats.rs +++ b/collector/src/artifact_stats.rs @@ -107,11 +107,11 @@ impl ArtifactStats { /// Normalizes the following things, in the following order: /// - Demangles the symbol. /// - Removes `.cold` and `.warm` from the end of the symbol, to merge cold and hot parts of a function -/// into the same symbol. +/// into the same symbol. /// - Removes rustc hashes from the symbol, e.g. `foo::[abcdef]` -> `foo::[]` or -/// `foo::abcd` -> `foo`. +/// `foo::abcd` -> `foo`. /// - Removes suffixes after a dot from the symbol, e.g. `anon.abcdef.123` -> `anon` or -/// `foo.llvm.123` -> `foo`. +/// `foo.llvm.123` -> `foo`. /// /// These modifications should remove things added by LLVM in the LTO/PGO phase. /// See more information here: https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html#vendor-specific-suffix diff --git a/collector/src/bin/rustc-fake.rs b/collector/src/bin/rustc-fake.rs index 3e079d1ef..3d48360bf 100644 --- a/collector/src/bin/rustc-fake.rs +++ b/collector/src/bin/rustc-fake.rs @@ -118,10 +118,7 @@ fn main() { let prof_out_dir = create_self_profile_dir(); if wrapper == "PerfStatSelfProfile" { - cmd.arg(&format!( - "-Zself-profile={}", - prof_out_dir.to_str().unwrap() - )); + cmd.arg(format!("-Zself-profile={}", prof_out_dir.to_str().unwrap())); let _ = fs::remove_dir_all(&prof_out_dir); let _ = fs::create_dir_all(&prof_out_dir); } @@ -189,10 +186,7 @@ fn main() { let prof_out_dir = create_self_profile_dir(); if wrapper == "XperfStatSelfProfile" { - tool.arg(&format!( - "-Zself-profile={}", - prof_out_dir.to_str().unwrap() - )); + tool.arg(format!("-Zself-profile={}", prof_out_dir.to_str().unwrap())); let _ = fs::remove_dir_all(&prof_out_dir); let _ = fs::create_dir_all(&prof_out_dir); } diff --git a/collector/src/compile/execute/bencher.rs b/collector/src/compile/execute/bencher.rs index 2e426e305..d76759846 100644 --- a/collector/src/compile/execute/bencher.rs +++ b/collector/src/compile/execute/bencher.rs @@ -120,7 +120,7 @@ impl<'a> BenchProcessor<'a> { } } -impl<'a> Processor for BenchProcessor<'a> { +impl Processor for BenchProcessor<'_> { fn perf_tool(&self) -> PerfTool { if self.is_first_collection && self.is_self_profile { if cfg!(unix) { @@ -309,7 +309,7 @@ impl SelfProfileS3Upload { .arg("INTELLIGENT_TIERING") .arg("--only-show-errors") .arg(upload.path()) - .arg(&format!( + .arg(format!( "s3://rustc-perf/{}", &prefix.join(filename).to_str().unwrap() )) diff --git a/collector/src/compile/execute/mod.rs b/collector/src/compile/execute/mod.rs index 2e719e6d3..37df1919c 100644 --- a/collector/src/compile/execute/mod.rs +++ b/collector/src/compile/execute/mod.rs @@ -583,11 +583,7 @@ fn process_stat_output( // In any case it's better than crashing the collector and looping indefinitely trying // to to complete a run -- which happens if we propagate `parse_self_profile`'s errors // up to the caller. - if let Ok(self_profile_data) = parse_self_profile(dir, krate) { - self_profile_data - } else { - (None, None) - } + parse_self_profile(dir, krate).unwrap_or_default() } _ => (None, None), }; @@ -640,9 +636,11 @@ fn parse_self_profile( // `perf` pid. So just blindly look in the directory to hopefully find it. for entry in fs::read_dir(dir)? { let entry = entry?; - if entry.file_name().to_str().map_or(false, |s| { - s.starts_with(&crate_name) && s.ends_with("mm_profdata") - }) { + if entry + .file_name() + .to_str() + .is_some_and(|s| s.starts_with(&crate_name) && s.ends_with("mm_profdata")) + { full_path = Some(entry.path()); break; } diff --git a/collector/src/compile/execute/profiler.rs b/collector/src/compile/execute/profiler.rs index ce6a4562f..069f6037d 100644 --- a/collector/src/compile/execute/profiler.rs +++ b/collector/src/compile/execute/profiler.rs @@ -106,7 +106,7 @@ impl<'a> ProfileProcessor<'a> { } } -impl<'a> Processor for ProfileProcessor<'a> { +impl Processor for ProfileProcessor<'_> { fn perf_tool(&self) -> PerfTool { PerfTool::ProfileTool(self.profiler) } diff --git a/collector/src/compile/execute/rustc.rs b/collector/src/compile/execute/rustc.rs index d42e2bd2c..f5b2823b2 100644 --- a/collector/src/compile/execute/rustc.rs +++ b/collector/src/compile/execute/rustc.rs @@ -91,10 +91,10 @@ async fn record( .arg("--set") .arg("rust.deny-warnings=false") .arg("--set") - .arg(&format!("build.rustc={}", fake_rustc.to_str().unwrap())) + .arg(format!("build.rustc={}", fake_rustc.to_str().unwrap())) .env("RUSTC_PERF_REAL_RUSTC", &toolchain.components.rustc) .arg("--set") - .arg(&format!( + .arg(format!( "build.cargo={}", toolchain.components.cargo.to_str().unwrap() )) diff --git a/collector/src/lib.rs b/collector/src/lib.rs index f03c299f5..94f1568da 100644 --- a/collector/src/lib.rs +++ b/collector/src/lib.rs @@ -85,7 +85,7 @@ impl<'de> Deserialize<'de> for Bound { { struct BoundVisitor; - impl<'de> serde::de::Visitor<'de> for BoundVisitor { + impl serde::de::Visitor<'_> for BoundVisitor { type Value = Bound; fn visit_str(self, value: &str) -> ::std::result::Result diff --git a/database/src/lib.rs b/database/src/lib.rs index aaa00ece8..21e3c2fbe 100644 --- a/database/src/lib.rs +++ b/database/src/lib.rs @@ -113,7 +113,7 @@ impl<'de> Deserialize<'de> for Date { { struct DateVisitor; - impl<'de> serde::de::Visitor<'de> for DateVisitor { + impl serde::de::Visitor<'_> for DateVisitor { type Value = Date; fn visit_str(self, value: &str) -> ::std::result::Result diff --git a/database/src/pool/postgres.rs b/database/src/pool/postgres.rs index 621f3e1bf..29355eb82 100644 --- a/database/src/pool/postgres.rs +++ b/database/src/pool/postgres.rs @@ -326,7 +326,7 @@ impl ConnectionManager for Postgres { } #[async_trait::async_trait] -impl<'a> Transaction for PostgresTransaction<'a> { +impl Transaction for PostgresTransaction<'_> { async fn commit(self: Box) -> Result<(), anyhow::Error> { Ok(self.conn.commit().await?) } diff --git a/database/src/pool/sqlite.rs b/database/src/pool/sqlite.rs index d7a16a5a4..d7abd5373 100644 --- a/database/src/pool/sqlite.rs +++ b/database/src/pool/sqlite.rs @@ -20,7 +20,7 @@ pub struct SqliteTransaction<'a> { } #[async_trait::async_trait] -impl<'a> Transaction for SqliteTransaction<'a> { +impl Transaction for SqliteTransaction<'_> { async fn commit(mut self: Box) -> Result<(), anyhow::Error> { self.finished = true; Ok(self.conn.raw().execute_batch("COMMIT")?) diff --git a/site/src/api.rs b/site/src/api.rs index 79bdcbbae..04cd9b811 100644 --- a/site/src/api.rs +++ b/site/src/api.rs @@ -21,7 +21,7 @@ where { struct CommaSeparatedVisitor(PhantomData); - impl<'de, T: DeserializeOwned> serde::de::Visitor<'de> for CommaSeparatedVisitor { + impl serde::de::Visitor<'_> for CommaSeparatedVisitor { type Value = Vec; fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { diff --git a/site/src/comparison.rs b/site/src/comparison.rs index d8cf69a1e..204ee63e4 100644 --- a/site/src/comparison.rs +++ b/site/src/comparison.rs @@ -994,7 +994,7 @@ impl ArtifactComparison { if let Some(b) = master_commits.iter().find(|c| c.sha == b.sha) { b.parent_sha == a.sha } else { - conn.parent_of(&b.sha).await.map_or(false, |p| p == a.sha) + conn.parent_of(&b.sha).await.as_ref() == Some(&a.sha) } } _ => false, diff --git a/site/src/request_handlers/graph.rs b/site/src/request_handlers/graph.rs index 68c83ec99..f73a9d70c 100644 --- a/site/src/request_handlers/graph.rs +++ b/site/src/request_handlers/graph.rs @@ -183,9 +183,8 @@ pub async fn handle_graphs( }; if is_default_query { - match &**ctxt.landing_page.load() { - Some(resp) => return Ok(resp.clone()), - None => {} + if let Some(resp) = &**ctxt.landing_page.load() { + return Ok(resp.clone()); } } diff --git a/site/src/self_profile/codegen_schedule.rs b/site/src/self_profile/codegen_schedule.rs index 262699f90..77adc2861 100644 --- a/site/src/self_profile/codegen_schedule.rs +++ b/site/src/self_profile/codegen_schedule.rs @@ -24,7 +24,7 @@ fn by_thread(self_profile_data: Vec) -> anyhow::Result<(u64, HashMap) -> anyhow::Result<(u64, HashMap, opt: Opt) -> anyhow::Result> // only handle Interval events for now for event in data .iter() - .filter(|e| e.timestamp().map_or(false, |t| !t.is_instant())) + .filter(|e| e.timestamp().is_some_and(|t| !t.is_instant())) { let duration = event.duration().unwrap(); if let Some(minimum_duration) = opt.minimum_duration { diff --git a/site/src/server.rs b/site/src/server.rs index dc298c2bb..317ffdb7f 100644 --- a/site/src/server.rs +++ b/site/src/server.rs @@ -343,9 +343,7 @@ async fn serve_req(server: Server, req: Request) -> Result