Use tempfile instead of tempdir
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Because tempdir is no longer maintained, because it has been combined with the tempfile crate.
authored by Thayne McCombs · committed by Thayne McCombs · parent 2aa966c · Browse files · 3 files·+33 added−52 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Relates-To: #1188
Diff stats
3 files+33 added−52 removed
- tests:+5 added−3 removed
- other:+28 added−49 removed
Provenance
- Commit
650a511- Tree
2d781af- Author
Thayne McCombs <astrothayne@gmail.com>- Committer
Thayne McCombs <astrothayne@gmail.com>- Parent
2aa966c
3 files changed+33 added−52 removed
modified:tests/testenv/mod.rs+5 added-3 removed
6 unmodified lines7 use std::os::windows;8 use std::path::{Path, PathBuf};9 use std::process;10 11-use tempdir::TempDir;11+use tempfile::TempDir;12 13 /// Environment for the integration tests.14 pub struct TestEnv {15 /// Temporary working directory.10 unmodified lines26 fn create_working_directory(27 directories: &[&'static str],28 files: &[&'static str],29 ) -> Result<TempDir, io::Error> {30- let temp_dir = TempDir::new("fd-tests")?;30+ let temp_dir = tempfile::Builder::new().prefix("fd-tests").tempdir()?;31 32 {33 let root = temp_dir.path();34 133 unmodified lines168 ) -> Result<PathBuf, io::Error> {169 let root = self.test_root();170 let broken_symlink_link = root.join(link_path);171 {172- let temp_target_dir = TempDir::new("fd-tests-broken-symlink")?;172+ let temp_target_dir = tempfile::Builder::new()173+ .prefix("fd-tests-broken-symlink")174+ .tempdir()?;175 let broken_symlink_target = temp_target_dir.path().join("broken_symlink_target");176 fs::File::create(&broken_symlink_target)?;177 #[cfg(unix)]178 unix::fs::symlink(&broken_symlink_target, &broken_symlink_link)?;145 unmodified linesmodified:Cargo.lock+27 added-48 removed
305 unmodified lines306 "winapi",307 ]308 309 [[package]]310+name = "fastrand"311+version = "1.8.0"312+source = "registry+https://github.com/rust-lang/crates.io-index"313+checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"314+dependencies = [315+ "instant",316+]317+318+[[package]]319 name = "fd-find"320 version = "8.5.3"321 dependencies = [322 "ansi_term",20 unmodified lines343 "num_cpus",344 "once_cell",345 "regex",346 "regex-syntax",338- "tempdir",347+ "tempfile",348 "test-case",349 "users",350 "version_check",351 ]22 unmodified lines374 source = "registry+https://github.com/rust-lang/crates.io-index"375 checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"376 377 [[package]]369-name = "fuchsia-cprng"370-version = "0.1.1"371-source = "registry+https://github.com/rust-lang/crates.io-index"372-checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"373-374-[[package]]378 name = "getrandom"379 version = "0.2.8"380 source = "registry+https://github.com/rust-lang/crates.io-index"381 checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"79 unmodified lines461 "winapi-util",462 ]463 464 [[package]]465+name = "instant"466+version = "0.1.12"467+source = "registry+https://github.com/rust-lang/crates.io-index"468+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"469+dependencies = [470+ "cfg-if",471+]472+473+[[package]]474 name = "io-lifetimes"475 version = "0.7.4"476 source = "registry+https://github.com/rust-lang/crates.io-index"477 checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0"194 unmodified lines672 "proc-macro2",673 ]674 675 [[package]]664-name = "rand"665-version = "0.4.6"666-source = "registry+https://github.com/rust-lang/crates.io-index"667-checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"668-dependencies = [669- "fuchsia-cprng",670- "libc",671- "rand_core 0.3.1",672- "rdrand",673- "winapi",674-]675-676-[[package]]677-name = "rand_core"678-version = "0.3.1"679-source = "registry+https://github.com/rust-lang/crates.io-index"680-checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"681-dependencies = [682- "rand_core 0.4.2",683-]684-685-[[package]]686-name = "rand_core"687-version = "0.4.2"688-source = "registry+https://github.com/rust-lang/crates.io-index"689-checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"690-691-[[package]]692-name = "rdrand"693-version = "0.4.0"694-source = "registry+https://github.com/rust-lang/crates.io-index"695-checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"696-dependencies = [697- "rand_core 0.3.1",698-]699-700-[[package]]676 name = "redox_syscall"677 version = "0.2.16"678 source = "registry+https://github.com/rust-lang/crates.io-index"679 checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"84 unmodified lines764 "unicode-ident",765 ]766 767 [[package]]793-name = "tempdir"794-version = "0.3.7"768+name = "tempfile"769+version = "3.3.0"770 source = "registry+https://github.com/rust-lang/crates.io-index"796-checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"771+checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"772 dependencies = [798- "rand",773+ "cfg-if",774+ "fastrand",775+ "libc",776+ "redox_syscall",777 "remove_dir_all",778+ "winapi",779 ]780 781 [[package]]782 name = "termcolor"314 unmodified linesmodified:Cargo.toml+1 added-1 removed
70 unmodified lines717273747575767778798 unmodified lines70 unmodified linesjemallocator = {version = "0.5.0", optional = true}
[dev-dependencies]diff = "0.1"tempdir = "0.3"tempfile = "3.3"filetime = "0.2"test-case = "2.2"
[profile.release]8 unmodified lines