tempdir -> tempfile

According to the documentation of the tempdir crate
This commit is contained in:
John Doty 2024-08-13 10:59:47 -07:00
parent e44d4dea7a
commit 663ce42016
3 changed files with 22 additions and 65 deletions

79
Cargo.lock generated
View file

@ -340,6 +340,12 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "fastrand"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.31" version = "1.0.31"
@ -350,12 +356,6 @@ dependencies = [
"miniz_oxide", "miniz_oxide",
] ]
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.30" version = "0.3.30"
@ -379,9 +379,9 @@ dependencies = [
"open", "open",
"pretty_assertions", "pretty_assertions",
"procfs", "procfs",
"rand 0.8.5", "rand",
"ratatui", "ratatui",
"tempdir", "tempfile",
"thiserror", "thiserror",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
@ -830,19 +830,6 @@ dependencies = [
"proc-macro2", "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]] [[package]]
name = "rand" name = "rand"
version = "0.8.5" version = "0.8.5"
@ -851,7 +838,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha",
"rand_core 0.6.4", "rand_core",
] ]
[[package]] [[package]]
@ -861,24 +848,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core 0.6.4", "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]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.6.4" version = "0.6.4"
@ -909,15 +881,6 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[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]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.3" version = "0.5.3"
@ -927,15 +890,6 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
] ]
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.24" version = "0.1.24"
@ -1144,13 +1098,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "tempdir" name = "tempfile"
version = "0.3.7" version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
dependencies = [ dependencies = [
"rand 0.4.6", "cfg-if",
"remove_dir_all", "fastrand",
"once_cell",
"rustix 0.38.34",
"windows-sys 0.59.0",
] ]
[[package]] [[package]]

View file

@ -34,7 +34,7 @@ xdg = "2"
[dev-dependencies] [dev-dependencies]
assert_matches = "1" assert_matches = "1"
pretty_assertions = "1" pretty_assertions = "1"
tempdir = "0.3" tempfile = "3"
[target.'cfg(target_os="linux")'.dependencies] [target.'cfg(target_os="linux")'.dependencies]
procfs = "0.14.1" procfs = "0.14.1"

View file

@ -117,7 +117,7 @@ async fn handle_connection(
mod tests { mod tests {
use super::*; use super::*;
use crate::message::MessageWriter; use crate::message::MessageWriter;
use tempdir::TempDir; use tempfile::TempDir;
#[test] #[test]
fn socket_path_repeats() { fn socket_path_repeats() {
@ -131,8 +131,8 @@ mod tests {
async fn url_to_message() { async fn url_to_message() {
let (sender, mut receiver) = mpsc::channel(64); let (sender, mut receiver) = mpsc::channel(64);
let tmp_dir = let tmp_dir = TempDir::with_prefix("url_to_message")
TempDir::new("url_to_message").expect("Error getting tmpdir"); .expect("Error getting tmpdir");
let path = tmp_dir.path().join("socket"); let path = tmp_dir.path().join("socket");
let path_override = path.clone(); let path_override = path.clone();