Skip to content

Commit 0b75b5f

Browse files
authored
Merge pull request #145 from TaKO8Ki/fix-clippy-warnings
Apply `cargo clippy --fix`
2 parents 72c8ac1 + 6fe4819 commit 0b75b5f

File tree

3 files changed

+29
-32
lines changed

3 files changed

+29
-32
lines changed

src/git.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ fn get_repo() -> Result<RustcRepo, Error> {
7777
.arg(&origin_remote)
7878
.current_dir(path)
7979
.status()
80-
.context(format!(
81-
"expected `git` command-line executable to be installed"
82-
))?;
80+
.context("expected `git` command-line executable to be installed".to_string())?;
8381
if !status.success() {
8482
bail!("git fetch failed exit status {}", status);
8583
}

src/main.rs

+22-23
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,7 @@ impl Config {
501501
}
502502
}
503503

504-
let repo_access: Box<dyn RustRepositoryAccessor>;
505-
repo_access = match args.access.as_deref() {
504+
let repo_access: Box<dyn RustRepositoryAccessor> = match args.access.as_deref() {
506505
None | Some("checkout") => Box::new(AccessViaLocalGit),
507506
Some("github") => Box::new(AccessViaGithub),
508507
Some(other) => bail!("unknown access argument: {}", other),
@@ -606,10 +605,10 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
606605
// bisection entry point
607606
fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
608607
if cfg.is_commit {
609-
let bisection_result = bisect_ci(&cfg, &client)?;
608+
let bisection_result = bisect_ci(cfg, client)?;
610609
print_results(cfg, client, &bisection_result);
611610
} else {
612-
let nightly_bisection_result = bisect_nightlies(&cfg, &client)?;
611+
let nightly_bisection_result = bisect_nightlies(cfg, client)?;
613612
print_results(cfg, client, &nightly_bisection_result);
614613
let nightly_regression = &nightly_bisection_result.searched[nightly_bisection_result.found];
615614

@@ -675,18 +674,18 @@ fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResu
675674

676675
if toolchains[*found] == *toolchains.last().unwrap() {
677676
let t = &toolchains[*found];
678-
let r = match t.install(&client, &dl_spec) {
677+
let r = match t.install(client, dl_spec) {
679678
Ok(()) => {
680-
let outcome = t.test(&cfg);
681-
remove_toolchain(cfg, t, &dl_spec);
679+
let outcome = t.test(cfg);
680+
remove_toolchain(cfg, t, dl_spec);
682681
// we want to fail, so a successful build doesn't satisfy us
683682
match outcome {
684683
TestOutcome::Baseline => Satisfies::No,
685684
TestOutcome::Regressed => Satisfies::Yes,
686685
}
687686
}
688687
Err(_) => {
689-
let _ = t.remove(&dl_spec);
688+
let _ = t.remove(dl_spec);
690689
Satisfies::Unknown
691690
}
692691
};
@@ -899,21 +898,21 @@ fn install_and_test(
899898
client: &Client,
900899
dl_spec: &DownloadParams,
901900
) -> Result<Satisfies, InstallError> {
902-
match t.install(&client, &dl_spec) {
901+
match t.install(client, dl_spec) {
903902
Ok(()) => {
904-
let outcome = t.test(&cfg);
903+
let outcome = t.test(cfg);
905904
// we want to fail, so a successful build doesn't satisfy us
906905
let r = match outcome {
907906
TestOutcome::Baseline => Satisfies::No,
908907
TestOutcome::Regressed => Satisfies::Yes,
909908
};
910909
eprintln!("RESULT: {}, ===> {}", t, r);
911-
remove_toolchain(cfg, t, &dl_spec);
910+
remove_toolchain(cfg, t, dl_spec);
912911
eprintln!();
913912
Ok(r)
914913
}
915914
Err(error) => {
916-
remove_toolchain(cfg, t, &dl_spec);
915+
remove_toolchain(cfg, t, dl_spec);
917916
Err(error)
918917
}
919918
}
@@ -925,8 +924,8 @@ fn bisect_to_regression(
925924
client: &Client,
926925
dl_spec: &DownloadParams,
927926
) -> usize {
928-
least_satisfying(&toolchains, |t| {
929-
match install_and_test(&t, &cfg, &client, &dl_spec) {
927+
least_satisfying(toolchains, |t| {
928+
match install_and_test(t, cfg, client, dl_spec) {
930929
Ok(r) => r,
931930
Err(_) => Satisfies::Unknown,
932931
}
@@ -962,7 +961,7 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
962961
bail!("cannot bisect nightlies with --alt: not supported");
963962
}
964963

965-
let dl_spec = DownloadParams::for_nightly(&cfg);
964+
let dl_spec = DownloadParams::for_nightly(cfg);
966965

967966
// before this date we didn't have -std packages
968967
let end_at = chrono::Date::from_utc(
@@ -1015,7 +1014,7 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
10151014
);
10161015
}
10171016

1018-
match install_and_test(&t, &cfg, &client, &dl_spec) {
1017+
match install_and_test(&t, cfg, client, &dl_spec) {
10191018
Ok(r) => {
10201019
// If Satisfies::No, then the regression was not identified in this nightly.
10211020
// Break out of the loop and use this as the start date for the
@@ -1064,7 +1063,7 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
10641063
t_end.std_targets.sort();
10651064
t_end.std_targets.dedup();
10661065

1067-
match install_and_test(&t_end, &cfg, &client, &dl_spec) {
1066+
match install_and_test(&t_end, cfg, client, &dl_spec) {
10681067
Ok(r) => {
10691068
// If Satisfies::No, then the regression was not identified in this nightly.
10701069
// this is an error, abort with error message
@@ -1086,7 +1085,7 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
10861085
ToolchainSpec::Nightly { date: last_failure },
10871086
);
10881087

1089-
let found = bisect_to_regression(&toolchains, &cfg, client, &dl_spec);
1088+
let found = bisect_to_regression(&toolchains, cfg, client, &dl_spec);
10901089

10911090
Ok(BisectionResult {
10921091
dl_spec,
@@ -1172,7 +1171,7 @@ fn bisect_ci_via(
11721171
)
11731172
}
11741173

1175-
bisect_ci_in_commits(cfg, client, &start_sha, &end_sha, commits)
1174+
bisect_ci_in_commits(cfg, client, start_sha, &end_sha, commits)
11761175
}
11771176

11781177
fn bisect_ci_in_commits(
@@ -1194,7 +1193,7 @@ fn bisect_ci_in_commits(
11941193
);
11951194
}
11961195

1197-
if let Some(ref c) = commits.last() {
1196+
if let Some(c) = commits.last() {
11981197
if end != "origin/master" && !c.sha.starts_with(end) {
11991198
bail!("expected to end with {}, but ended with {}", end, c.sha);
12001199
}
@@ -1222,7 +1221,7 @@ fn bisect_ci_in_commits(
12221221

12231222
if !toolchains.is_empty() {
12241223
// validate commit at start of range
1225-
match install_and_test(&toolchains[0], &cfg, &client, &dl_spec) {
1224+
match install_and_test(&toolchains[0], cfg, client, &dl_spec) {
12261225
Ok(r) => {
12271226
// If Satisfies::Yes, then the commit at the beginning of the range
12281227
// has the regression, this is an error
@@ -1237,7 +1236,7 @@ fn bisect_ci_in_commits(
12371236
}
12381237

12391238
// validate commit at end of range
1240-
match install_and_test(&toolchains[toolchains.len() - 1], &cfg, &client, &dl_spec) {
1239+
match install_and_test(&toolchains[toolchains.len() - 1], cfg, client, &dl_spec) {
12411240
Ok(r) => {
12421241
// If Satisfies::No, then the regression was not identified at the end of the
12431242
// commit range, this is an error
@@ -1252,7 +1251,7 @@ fn bisect_ci_in_commits(
12521251
}
12531252
}
12541253

1255-
let found = bisect_to_regression(&toolchains, &cfg, client, &dl_spec);
1254+
let found = bisect_to_regression(&toolchains, cfg, client, &dl_spec);
12561255

12571256
Ok(BisectionResult {
12581257
searched: toolchains,

src/toolchains.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl Toolchain {
191191

192192
// download rustc.
193193
if let Err(e) = download_tarball(
194-
&client,
194+
client,
195195
&format!("rustc for {}", self.host),
196196
&format!(
197197
"{}/{}/{}.tar",
@@ -215,7 +215,7 @@ impl Toolchain {
215215
for target in &self.std_targets {
216216
let rust_std_filename = format!("rust-std-nightly-{}", target);
217217
download_tarball(
218-
&client,
218+
client,
219219
&format!("std for {}", target),
220220
&format!(
221221
"{}/{}/{}.tar",
@@ -238,7 +238,7 @@ impl Toolchain {
238238
if !dl_params.without_cargo {
239239
let filename = format!("cargo-nightly-{}", self.host);
240240
download_tarball(
241-
&client,
241+
client,
242242
&format!("cargo for {}", self.host),
243243
&format!("{}/{}/{}.tar", dl_params.url_prefix, location, filename,),
244244
Some(&PathBuf::from(&filename).join("cargo")),
@@ -250,7 +250,7 @@ impl Toolchain {
250250
if dl_params.install_src {
251251
let filename = "rust-src-nightly";
252252
download_tarball(
253-
&client,
253+
client,
254254
"rust-src",
255255
&format!("{}/{}/{}.tar", dl_params.url_prefix, location, filename,),
256256
Some(&PathBuf::from(&filename).join("rust-src")),
@@ -262,7 +262,7 @@ impl Toolchain {
262262
if dl_params.install_dev {
263263
let filename = format!("rustc-dev-nightly-{}", self.host);
264264
download_tarball(
265-
&client,
265+
client,
266266
"rustc-dev",
267267
&format!("{}/{}/{}.tar", dl_params.url_prefix, location, filename,),
268268
Some(&PathBuf::from(&filename).join(format!("rustc-dev-{}", self.host))),
@@ -272,7 +272,7 @@ impl Toolchain {
272272
// llvm-tools-(preview) is currently required for using rustc-dev https://github.com/rust-lang/rust/issues/72594
273273
let filename = format!("llvm-tools-nightly-{}", self.host);
274274
download_tarball(
275-
&client,
275+
client,
276276
"llvm-tools",
277277
&format!("{}/{}/{}.tar", dl_params.url_prefix, location, filename,),
278278
Some(&PathBuf::from(&filename).join("llvm-tools-preview")),

0 commit comments

Comments
 (0)