Skip to content

Commit 49e0137

Browse files
authored
Rollup merge of rust-lang#94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum
Remove redundant slicing of whole ranges in `bootstrap` Found with `clippy::redundant_slicing`.
2 parents 8c87132 + df9797b commit 49e0137

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/bootstrap/setup.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ fn rustup_installed() -> bool {
161161
}
162162

163163
fn stage_dir_exists(stage_path: &str) -> bool {
164-
match fs::create_dir(&stage_path[..]) {
164+
match fs::create_dir(&stage_path) {
165165
Ok(_) => true,
166-
Err(_) => Path::new(&stage_path[..]).exists(),
166+
Err(_) => Path::new(&stage_path).exists(),
167167
}
168168
}
169169

@@ -179,7 +179,7 @@ fn attempt_toolchain_link(stage_path: &str) {
179179
return;
180180
}
181181

182-
if try_link_toolchain(&stage_path[..]) {
182+
if try_link_toolchain(&stage_path) {
183183
println!(
184184
"Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain"
185185
);
@@ -188,7 +188,7 @@ fn attempt_toolchain_link(stage_path: &str) {
188188
println!(
189189
"To manually link stage 1 build to `stage1` toolchain, run:\n
190190
`rustup toolchain link stage1 {}`",
191-
&stage_path[..]
191+
&stage_path
192192
);
193193
}
194194
}
@@ -222,7 +222,7 @@ fn toolchain_is_linked() -> bool {
222222
fn try_link_toolchain(stage_path: &str) -> bool {
223223
Command::new("rustup")
224224
.stdout(std::process::Stdio::null())
225-
.args(&["toolchain", "link", "stage1", &stage_path[..]])
225+
.args(&["toolchain", "link", "stage1", &stage_path])
226226
.output()
227227
.map_or(false, |output| output.status.success())
228228
}

0 commit comments

Comments
 (0)