Skip to content

Commit c1c7a81

Browse files
authored
Merge pull request #3199 from hi-rustin/rustin-patch-make-clippy-happy
Make clippy happy
2 parents 0b39dc6 + 19213c8 commit c1c7a81

16 files changed

+146
-160
lines changed

src/cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ pub(crate) fn cli() -> App<'static, 'static> {
747747
)
748748
}
749749

750-
fn verbose_arg<'a, 'b>(help: &'b str) -> Arg<'a, 'b> {
750+
fn verbose_arg(help: &str) -> Arg<'_, '_> {
751751
Arg::with_name("verbose")
752752
.help(help)
753753
.takes_value(false)

src/cli/self_update.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ fn customize_install(mut opts: InstallOpts<'_>) -> Result<InstallOpts<'_>> {
712712
fn install_bins() -> Result<()> {
713713
let bin_path = utils::cargo_home()?.join("bin");
714714
let this_exe_path = utils::current_exe()?;
715-
let rustup_path = bin_path.join(&format!("rustup{EXE_SUFFIX}"));
715+
let rustup_path = bin_path.join(format!("rustup{EXE_SUFFIX}"));
716716

717717
utils::ensure_dir_exists("bin", &bin_path, &|_: Notification<'_>| {})?;
718718
// NB: Even on Linux we can't just copy the new binary over the (running)
@@ -1088,8 +1088,8 @@ fn parse_new_rustup_version(version: String) -> String {
10881088

10891089
pub(crate) fn prepare_update() -> Result<Option<PathBuf>> {
10901090
let cargo_home = utils::cargo_home()?;
1091-
let rustup_path = cargo_home.join(&format!("bin{MAIN_SEPARATOR}rustup{EXE_SUFFIX}"));
1092-
let setup_path = cargo_home.join(&format!("bin{MAIN_SEPARATOR}rustup-init{EXE_SUFFIX}"));
1091+
let rustup_path = cargo_home.join(format!("bin{MAIN_SEPARATOR}rustup{EXE_SUFFIX}"));
1092+
let setup_path = cargo_home.join(format!("bin{MAIN_SEPARATOR}rustup-init{EXE_SUFFIX}"));
10931093

10941094
if !rustup_path.exists() {
10951095
return Err(CLIError::NotSelfInstalled { p: cargo_home }.into());
@@ -1212,7 +1212,7 @@ pub(crate) fn check_rustup_update() -> Result<()> {
12121212

12131213
pub(crate) fn cleanup_self_updater() -> Result<()> {
12141214
let cargo_home = utils::cargo_home()?;
1215-
let setup = cargo_home.join(&format!("bin/rustup-init{EXE_SUFFIX}"));
1215+
let setup = cargo_home.join(format!("bin/rustup-init{EXE_SUFFIX}"));
12161216

12171217
if setup.exists() {
12181218
utils::remove_file("setup", &setup)?;

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ impl Cfg {
865865

866866
// Filter out toolchains that don't track a release channel
867867
Ok(toolchains
868-
.filter(|&(_, ref t)| t.as_ref().map(Toolchain::is_tracking).unwrap_or(false))
868+
.filter(|(_, ref t)| t.as_ref().map(Toolchain::is_tracking).unwrap_or(false))
869869
.collect())
870870
}
871871

src/diskio/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ pub(crate) fn perform<F: Fn(usize)>(item: &mut Item, chunk_complete_callback: F)
342342
write_file(&item.full_path, contents, item.mode)
343343
}
344344
FileBuffer::Threaded(ref mut contents) => {
345-
write_file(&item.full_path, &contents, item.mode)
345+
write_file(&item.full_path, contents, item.mode)
346346
}
347347
}
348348
}

src/dist/component/package.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ enum DirStatus {
284284
Pending(Vec<Item>),
285285
}
286286

287-
fn unpack_without_first_dir<'a, R: Read>(
287+
fn unpack_without_first_dir<R: Read>(
288288
archive: &mut tar::Archive<R>,
289289
path: &Path,
290-
notify_handler: Option<&'a dyn Fn(Notification<'_>)>,
290+
notify_handler: Option<&dyn Fn(Notification<'_>)>,
291291
) -> Result<()> {
292292
let entries = archive.entries()?;
293293
let effective_max_ram = match effective_limits::memory_limit() {
@@ -347,10 +347,10 @@ fn unpack_without_first_dir<'a, R: Read>(
347347

348348
/// true if either no sender_entry was provided, or the incremental file
349349
/// has been fully dispatched.
350-
fn flush_ios<'a, R: std::io::Read, P: AsRef<Path>>(
350+
fn flush_ios<R: std::io::Read, P: AsRef<Path>>(
351351
io_executor: &mut dyn Executor,
352352
directories: &mut HashMap<PathBuf, DirStatus>,
353-
mut sender_entry: Option<&mut SenderEntry<'a, '_, R>>,
353+
mut sender_entry: Option<&mut SenderEntry<'_, '_, R>>,
354354
full_path: P,
355355
) -> Result<bool> {
356356
let mut result = sender_entry.is_none();

src/dist/dist.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,8 @@ pub(crate) fn valid_profile_names() -> String {
650650
// an upgrade then all the existing components will be upgraded.
651651
//
652652
// Returns the manifest's hash if anything changed.
653-
pub(crate) fn update_from_dist<'a>(
654-
download: DownloadCfg<'a>,
653+
pub(crate) fn update_from_dist(
654+
download: DownloadCfg<'_>,
655655
update_hash: Option<&Path>,
656656
toolchain: &ToolchainDesc,
657657
profile: Option<Profile>,
@@ -694,8 +694,8 @@ pub(crate) fn update_from_dist<'a>(
694694
res
695695
}
696696

697-
fn update_from_dist_<'a>(
698-
download: DownloadCfg<'a>,
697+
fn update_from_dist_(
698+
download: DownloadCfg<'_>,
699699
update_hash: Option<&Path>,
700700
toolchain: &ToolchainDesc,
701701
profile: Option<Profile>,
@@ -830,8 +830,8 @@ fn update_from_dist_<'a>(
830830
}
831831
}
832832

833-
fn try_update_from_dist_<'a>(
834-
download: DownloadCfg<'a>,
833+
fn try_update_from_dist_(
834+
download: DownloadCfg<'_>,
835835
update_hash: Option<&Path>,
836836
toolchain: &ToolchainDesc,
837837
profile: Option<Profile>,
@@ -1018,8 +1018,8 @@ fn try_update_from_dist_<'a>(
10181018
}
10191019
}
10201020

1021-
pub(crate) fn dl_v2_manifest<'a>(
1022-
download: DownloadCfg<'a>,
1021+
pub(crate) fn dl_v2_manifest(
1022+
download: DownloadCfg<'_>,
10231023
update_hash: Option<&Path>,
10241024
toolchain: &ToolchainDesc,
10251025
) -> Result<Option<(ManifestV2, String)>> {

src/utils/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ pub(crate) fn create_rustup_home() -> Result<()> {
510510
}
511511

512512
let home = rustup_home_in_user_dir()?;
513-
fs::create_dir_all(&home).context("unable to create ~/.rustup")?;
513+
fs::create_dir_all(home).context("unable to create ~/.rustup")?;
514514

515515
Ok(())
516516
}

tests/cli-inst-interactive.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ fn install_stops_if_rustc_exists() {
529529
.tempdir()
530530
.unwrap();
531531
// Create fake executable
532-
let fake_exe = temp_dir.path().join(&format!("{}{}", "rustc", EXE_SUFFIX));
532+
let fake_exe = temp_dir.path().join(format!("{}{}", "rustc", EXE_SUFFIX));
533533
raw::append_file(&fake_exe, "").unwrap();
534534
let temp_dir_path = temp_dir.path().to_str().unwrap();
535535

@@ -560,7 +560,7 @@ fn install_stops_if_cargo_exists() {
560560
.tempdir()
561561
.unwrap();
562562
// Create fake executable
563-
let fake_exe = temp_dir.path().join(&format!("{}{}", "cargo", EXE_SUFFIX));
563+
let fake_exe = temp_dir.path().join(format!("{}{}", "cargo", EXE_SUFFIX));
564564
raw::append_file(&fake_exe, "").unwrap();
565565
let temp_dir_path = temp_dir.path().to_str().unwrap();
566566

@@ -591,7 +591,7 @@ fn with_no_prompt_install_succeeds_if_rustc_exists() {
591591
.tempdir()
592592
.unwrap();
593593
// Create fake executable
594-
let fake_exe = temp_dir.path().join(&format!("{}{}", "rustc", EXE_SUFFIX));
594+
let fake_exe = temp_dir.path().join(format!("{}{}", "rustc", EXE_SUFFIX));
595595
raw::append_file(&fake_exe, "").unwrap();
596596
let temp_dir_path = temp_dir.path().to_str().unwrap();
597597

tests/cli-misc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ fn rustup_failed_path_search() {
389389
setup(&|config| {
390390
use std::env::consts::EXE_SUFFIX;
391391

392-
let rustup_path = config.exedir.join(&format!("rustup{EXE_SUFFIX}"));
393-
let tool_path = config.exedir.join(&format!("fake_proxy{EXE_SUFFIX}"));
392+
let rustup_path = config.exedir.join(format!("rustup{EXE_SUFFIX}"));
393+
let tool_path = config.exedir.join(format!("fake_proxy{EXE_SUFFIX}"));
394394
utils::hardlink_file(&rustup_path, &tool_path)
395395
.expect("Failed to create fake proxy for test");
396396

@@ -426,8 +426,8 @@ fn rustup_failed_path_search_toolchain() {
426426
setup(&|config| {
427427
use std::env::consts::EXE_SUFFIX;
428428

429-
let rustup_path = config.exedir.join(&format!("rustup{EXE_SUFFIX}"));
430-
let tool_path = config.exedir.join(&format!("cargo-miri{EXE_SUFFIX}"));
429+
let rustup_path = config.exedir.join(format!("rustup{EXE_SUFFIX}"));
430+
let tool_path = config.exedir.join(format!("cargo-miri{EXE_SUFFIX}"));
431431
utils::hardlink_file(&rustup_path, &tool_path)
432432
.expect("Failed to create fake cargo-miri for test");
433433

tests/cli-rustup.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ fn add_target() {
336336
);
337337
expect_ok(config, &["rustup", "default", "nightly"]);
338338
expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]);
339-
assert!(config.rustupdir.has(&path));
339+
assert!(config.rustupdir.has(path));
340340
});
341341
}
342342

@@ -378,13 +378,13 @@ fn add_remove_multiple_targets() {
378378
&this_host_triple(),
379379
clitools::CROSS_ARCH1
380380
);
381-
assert!(config.rustupdir.has(&path));
381+
assert!(config.rustupdir.has(path));
382382
let path = format!(
383383
"toolchains/nightly-{}/lib/rustlib/{}/lib/libstd.rlib",
384384
&this_host_triple(),
385385
clitools::CROSS_ARCH2
386386
);
387-
assert!(config.rustupdir.has(&path));
387+
assert!(config.rustupdir.has(path));
388388

389389
expect_ok(
390390
config,
@@ -401,13 +401,13 @@ fn add_remove_multiple_targets() {
401401
&this_host_triple(),
402402
clitools::CROSS_ARCH1
403403
);
404-
assert!(!config.rustupdir.has(&path));
404+
assert!(!config.rustupdir.has(path));
405405
let path = format!(
406406
"toolchains/nightly-{}/lib/rustlib/{}/lib/libstd.rlib",
407407
&this_host_triple(),
408408
clitools::CROSS_ARCH2
409409
);
410-
assert!(!config.rustupdir.has(&path));
410+
assert!(!config.rustupdir.has(path));
411411
});
412412
}
413413

@@ -449,7 +449,7 @@ fn add_target_explicit() {
449449
clitools::CROSS_ARCH1,
450450
],
451451
);
452-
assert!(config.rustupdir.has(&path));
452+
assert!(config.rustupdir.has(path));
453453
});
454454
}
455455

@@ -528,7 +528,7 @@ fn fallback_cargo_calls_correct_rustc() {
528528
let cargo_bin_path = config.cargodir.join("bin");
529529
fs::create_dir_all(&cargo_bin_path).unwrap();
530530
let rustc_path = cargo_bin_path.join(format!("rustc{EXE_SUFFIX}"));
531-
fs::hard_link(&rustup_path, &rustc_path).unwrap();
531+
fs::hard_link(rustup_path, &rustc_path).unwrap();
532532

533533
// Install a custom toolchain and a nightly toolchain for the cargo fallback
534534
let path = config.customdir.join("custom-1");
@@ -1309,7 +1309,7 @@ fn add_component() {
13091309
"toolchains/stable-{}/lib/rustlib/src/rust-src/foo.rs",
13101310
this_host_triple()
13111311
);
1312-
assert!(config.rustupdir.has(&path));
1312+
assert!(config.rustupdir.has(path));
13131313
});
13141314
}
13151315

@@ -1527,7 +1527,7 @@ fn file_override_path_no_options() {
15271527
let cwd = config.current_dir();
15281528
let toolchain_path = cwd.join("ephemeral");
15291529
let toolchain_bin = toolchain_path.join("bin");
1530-
fs::create_dir_all(&toolchain_bin).unwrap();
1530+
fs::create_dir_all(toolchain_bin).unwrap();
15311531

15321532
let toolchain_file = cwd.join("rust-toolchain.toml");
15331533
raw::write_file(
@@ -1575,7 +1575,7 @@ fn file_override_path_xor_channel() {
15751575
let cwd = config.current_dir();
15761576
let toolchain_path = cwd.join("ephemeral");
15771577
let toolchain_bin = toolchain_path.join("bin");
1578-
fs::create_dir_all(&toolchain_bin).unwrap();
1578+
fs::create_dir_all(toolchain_bin).unwrap();
15791579

15801580
let toolchain_file = cwd.join("rust-toolchain.toml");
15811581
raw::write_file(

0 commit comments

Comments
 (0)