From ef22ceb4048ce7c0146e9d4a62c000247669c0ac Mon Sep 17 00:00:00 2001 From: LingMan Date: Thu, 16 Jun 2022 03:35:19 +0200 Subject: [PATCH] Replace deprecated dependency `tempdir` with its successor `tempfile` --- Cargo.lock | 59 +++-------------------------------------------- Cargo.toml | 2 +- src/toolchains.rs | 5 ++-- 3 files changed, 7 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 076c99f..52a6195 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,7 +86,7 @@ dependencies = [ "serde_json", "tar", "tee", - "tempdir", + "tempfile", "thiserror", "trycmd", "xz2", @@ -414,12 +414,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "futures-channel" version = "0.3.21" @@ -1022,7 +1016,7 @@ checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" dependencies = [ "env_logger 0.8.4", "log", - "rand 0.8.5", + "rand", ] [[package]] @@ -1034,43 +1028,15 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "rand_core 0.6.3", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.3" @@ -1104,15 +1070,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.13" @@ -1384,16 +1341,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37c12559dba7383625faaff75be24becf35bfc885044375bcab931111799a3da" -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" version = "3.3.0" diff --git a/Cargo.toml b/Cargo.toml index 1acf013..e8a0d10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ serde_json = "1.0" clap = { version = "3.1", features = ["derive"] } tar = "0.4" tee = "0.1" -tempdir = "0.3.7" +tempfile = "3" xz2 = "0.1.6" chrono = "0.4.11" colored = "2" diff --git a/src/toolchains.rs b/src/toolchains.rs index bdd31f8..0ffa77a 100644 --- a/src/toolchains.rs +++ b/src/toolchains.rs @@ -15,7 +15,6 @@ use reqwest::header::CONTENT_LENGTH; use rustc_version::Channel; use tar::Archive; use tee::TeeReader; -use tempdir::TempDir; use xz2::read::XzDecoder; use crate::Config; @@ -109,7 +108,9 @@ impl Toolchain { ) -> Result<(), InstallError> { let tc_stdstream_str = format!("{self}"); eprintln!("installing {}", tc_stdstream_str.green()); - let tmpdir = TempDir::new_in(&dl_params.tmp_dir, &self.rustup_name()) + let tmpdir = tempfile::Builder::new() + .prefix(&self.rustup_name()) + .tempdir_in(&dl_params.tmp_dir) .map_err(InstallError::TempDir)?; let dest = dl_params.install_dir.join(self.rustup_name()); if dl_params.force_install {