about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-03-12 09:35:47 +0100
committerGitHub <noreply@github.com>2022-03-12 09:35:47 +0100
commit49e0137a158ac72ac84918b287ac3d8a8a991990 (patch)
tree7e9bad99d3ad5f2ad75676bd28b19b9ceb16f0e0
parent8c87132103e350821bb8f8abbd90f3d6feebecd1 (diff)
parentdf9797b7918fdfffcae2681fb636bf621cad2fc7 (diff)
downloadrust-49e0137a158ac72ac84918b287ac3d8a8a991990.tar.gz
rust-49e0137a158ac72ac84918b287ac3d8a8a991990.zip
Rollup merge of #94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum
Remove redundant slicing of whole ranges in `bootstrap`

Found with `clippy::redundant_slicing`.
-rw-r--r--src/bootstrap/setup.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index e1235829b3a..aff2b6c3cbf 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -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(),
     }
 }
 
@@ -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"
         );
@@ -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
         );
     }
 }
@@ -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())
 }