Skip to content

Commit 36cee86

Browse files
committed
Format
1 parent e74d88d commit 36cee86

File tree

5 files changed

+46
-39
lines changed

5 files changed

+46
-39
lines changed

collector/benchlib/src/benchmark.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,15 @@ impl<'a> BenchmarkGroup<'a> {
119119

120120
fn profile_benchmark(self, args: ProfileArgs) -> anyhow::Result<()> {
121121
let Some(benchmark) = self.benchmarks.get(args.benchmark.as_str()) else {
122-
return Err(anyhow::anyhow!("Benchmark `{}` not found. Available benchmarks: {}", args.benchmark,
123-
self.benchmarks.keys().map(|s| s.to_string()).collect::<Vec<_>>().join(", ")));
122+
return Err(anyhow::anyhow!(
123+
"Benchmark `{}` not found. Available benchmarks: {}",
124+
args.benchmark,
125+
self.benchmarks
126+
.keys()
127+
.map(|s| s.to_string())
128+
.collect::<Vec<_>>()
129+
.join(", ")
130+
));
124131
};
125132
(benchmark.profile_fn)();
126133

collector/src/bin/collector.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ use collector::runtime::{
3838
};
3939
use collector::runtime::{profile_runtime, RuntimeCompilationOpts};
4040
use collector::toolchain::{
41-
create_toolchain_from_published_version, get_local_toolchain, Sysroot, Toolchain, ToolchainConfig,
41+
create_toolchain_from_published_version, get_local_toolchain, Sysroot, Toolchain,
42+
ToolchainConfig,
4243
};
4344
use collector::utils::cachegrind::cachegrind_diff;
4445
use collector::utils::{is_installed, wait_for_future};
@@ -378,7 +379,7 @@ struct CompileTimeOptions {
378379

379380
/// The path to the local clippy to measure
380381
#[arg(long)]
381-
clippy: Option<PathBuf>
382+
clippy: Option<PathBuf>,
382383
}
383384

384385
#[derive(Debug, clap::Args)]
@@ -1197,18 +1198,9 @@ fn bench_published_artifact(
11971198
let artifact_id = ArtifactId::Tag(toolchain.id.clone());
11981199

11991200
let profiles = if collector::version_supports_doc(&toolchain.id) {
1200-
vec![
1201-
Profile::Check,
1202-
Profile::Debug,
1203-
Profile::Doc,
1204-
Profile::Opt
1205-
]
1201+
vec![Profile::Check, Profile::Debug, Profile::Doc, Profile::Opt]
12061202
} else {
1207-
vec![
1208-
Profile::Check,
1209-
Profile::Debug,
1210-
Profile::Opt,
1211-
]
1203+
vec![Profile::Check, Profile::Debug, Profile::Opt]
12121204
};
12131205
let scenarios = if collector::version_supports_incremental(&toolchain.id) {
12141206
Scenario::all()

collector/src/toolchain.rs

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl SysrootDownload {
125125
Some(sysroot_bin("rustdoc")?),
126126
match sysroot_bin("cargo-clippy") {
127127
Err(_) => None,
128-
Ok(path) => Some(path)
128+
Ok(path) => Some(path),
129129
},
130130
sysroot_bin("cargo")?,
131131
&self.directory.join(&self.rust_sha).join("lib"),
@@ -435,26 +435,27 @@ pub fn get_local_toolchain(
435435
None
436436
};
437437

438-
let clippy =
439-
if let Some(clippy) = &toolchain_config.clippy {
440-
Some(clippy.canonicalize().with_context(|| {
438+
let clippy = if let Some(clippy) = &toolchain_config.clippy {
439+
Some(
440+
clippy.canonicalize().with_context(|| {
441441
format!("failed to canonicalize clippy executable {:?}", clippy)
442-
})?)
443-
} else if profiles.contains(&Profile::Clippy) {
444-
// We need a `clippy`. Look for one next to `rustc`.
445-
if let Ok(clippy) = rustc.with_file_name("cargo-clippy").canonicalize() {
446-
debug!("found clippy: {:?}", &clippy);
447-
Some(clippy)
448-
} else {
449-
anyhow::bail!(
442+
})?,
443+
)
444+
} else if profiles.contains(&Profile::Clippy) {
445+
// We need a `clippy`. Look for one next to `rustc`.
446+
if let Ok(clippy) = rustc.with_file_name("cargo-clippy").canonicalize() {
447+
debug!("found clippy: {:?}", &clippy);
448+
Some(clippy)
449+
} else {
450+
anyhow::bail!(
450451
"'Clippy' build specified but '--clippy' not specified and no 'cargo-clippy' found \
451452
next to 'rustc'"
452453
);
453-
}
454-
} else {
455-
// No `clippy` provided, but none needed.
456-
None
457-
};
454+
}
455+
} else {
456+
// No `clippy` provided, but none needed.
457+
None
458+
};
458459
let cargo = if let Some(cargo) = &toolchain_config.cargo {
459460
cargo
460461
.canonicalize()
@@ -483,7 +484,9 @@ pub fn get_local_toolchain(
483484
let lib_dir = get_lib_dir_from_rustc(&rustc).context("Cannot find libdir for rustc")?;
484485

485486
Ok(Toolchain {
486-
components: ToolchainComponents::from_binaries_and_libdir(rustc, rustdoc, clippy, cargo, &lib_dir)?,
487+
components: ToolchainComponents::from_binaries_and_libdir(
488+
rustc, rustdoc, clippy, cargo, &lib_dir,
489+
)?,
487490
id,
488491
triple: target_triple,
489492
})
@@ -530,8 +533,13 @@ pub fn create_toolchain_from_published_version(
530533

531534
let lib_dir = get_lib_dir_from_rustc(&rustc)?;
532535

533-
let components =
534-
ToolchainComponents::from_binaries_and_libdir(rustc, Some(rustdoc), Some(clippy), cargo, &lib_dir)?;
536+
let components = ToolchainComponents::from_binaries_and_libdir(
537+
rustc,
538+
Some(rustdoc),
539+
Some(clippy),
540+
cargo,
541+
&lib_dir,
542+
)?;
535543

536544
Ok(Toolchain {
537545
components,

database/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ pub enum Profile {
225225
/// An optimized "release" build
226226
Opt,
227227
/// A Clippy run
228-
Clippy
228+
Clippy,
229229
}
230230

231231
impl Profile {
@@ -235,7 +235,7 @@ impl Profile {
235235
Profile::Opt => "opt",
236236
Profile::Debug => "debug",
237237
Profile::Doc => "doc",
238-
Profile::Clippy => "clippy"
238+
Profile::Clippy => "clippy",
239239
}
240240
}
241241
}

site/src/request_handlers/dashboard.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub struct ByProfile<T> {
150150
pub debug: T,
151151
pub doc: T,
152152
pub opt: T,
153-
pub clippy: T
153+
pub clippy: T,
154154
}
155155

156156
impl<T> ByProfile<T> {
@@ -177,7 +177,7 @@ impl<T> std::ops::Index<Profile> for ByProfile<T> {
177177
Profile::Debug => &self.debug,
178178
Profile::Doc => &self.doc,
179179
Profile::Opt => &self.opt,
180-
Profile::Clippy => &self.clippy
180+
Profile::Clippy => &self.clippy,
181181
}
182182
}
183183
}

0 commit comments

Comments
 (0)