Skip to content

Commit

Permalink
Rollup merge of #94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Remove redundant slicing of whole ranges in `bootstrap`

Found with `clippy::redundant_slicing`.
  • Loading branch information
matthiaskrgr authored Mar 12, 2022
2 parents 8c87132 + df9797b commit 49e0137
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/bootstrap/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ fn rustup_installed() -> bool {
}

fn stage_dir_exists(stage_path: &str) -> bool {
match fs::create_dir(&stage_path[..]) {
match fs::create_dir(&stage_path) {
Ok(_) => true,
Err(_) => Path::new(&stage_path[..]).exists(),
Err(_) => Path::new(&stage_path).exists(),
}
}

Expand All @@ -179,7 +179,7 @@ fn attempt_toolchain_link(stage_path: &str) {
return;
}

if try_link_toolchain(&stage_path[..]) {
if try_link_toolchain(&stage_path) {
println!(
"Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain"
);
Expand All @@ -188,7 +188,7 @@ fn attempt_toolchain_link(stage_path: &str) {
println!(
"To manually link stage 1 build to `stage1` toolchain, run:\n
`rustup toolchain link stage1 {}`",
&stage_path[..]
&stage_path
);
}
}
Expand Down Expand Up @@ -222,7 +222,7 @@ fn toolchain_is_linked() -> bool {
fn try_link_toolchain(stage_path: &str) -> bool {
Command::new("rustup")
.stdout(std::process::Stdio::null())
.args(&["toolchain", "link", "stage1", &stage_path[..]])
.args(&["toolchain", "link", "stage1", &stage_path])
.output()
.map_or(false, |output| output.status.success())
}
Expand Down

0 comments on commit 49e0137

Please sign in to comment.