diff --git a/Cargo.lock b/Cargo.lock index 53ab308..2ec92b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -638,6 +638,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "exr" version = "1.72.0" @@ -654,6 +664,12 @@ dependencies = [ "zune-inflate", ] +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + [[package]] name = "fdeflate" version = "0.3.4" @@ -697,12 +713,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 = "funty" version = "2.0.0" @@ -1160,6 +1170,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + [[package]] name = "lock_api" version = "0.4.11" @@ -1545,19 +1561,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[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" @@ -1566,7 +1569,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1576,24 +1579,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "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]] name = "rand_core" version = "0.6.4" @@ -1629,7 +1617,7 @@ dependencies = [ "once_cell", "paste", "profiling", - "rand 0.8.5", + "rand", "rand_chacha", "simd_helpers", "system-deps", @@ -1691,7 +1679,7 @@ dependencies = [ "rayhunter", "serde", "serde_json", - "tempdir", + "tempfile", "thiserror", "tokio", "tokio-stream", @@ -1719,15 +1707,6 @@ dependencies = [ "crossbeam-utils", ] -[[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.4.1" @@ -1766,15 +1745,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rgb" version = "0.8.37" @@ -1807,6 +1777,19 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -2031,13 +2014,15 @@ dependencies = [ ] [[package]] -name = "tempdir" -version = "0.3.7" +name = "tempfile" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "rand 0.4.6", - "remove_dir_all", + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", ] [[package]] diff --git a/bin/Cargo.toml b/bin/Cargo.toml index 424e243..939985a 100644 --- a/bin/Cargo.toml +++ b/bin/Cargo.toml @@ -25,10 +25,10 @@ tokio-util = { version = "0.7.10", features = ["rt"] } futures-macro = "0.3.30" include_dir = "0.7.3" mime_guess = "2.0.4" -tempdir = "0.3.7" chrono = { version = "0.4.31", features = ["serde"] } tokio-stream = "0.1.14" futures = "0.3.30" clap = { version = "4.5.2", features = ["derive"] } serde_json = "1.0.114" image = "0.25.1" +tempfile = "3.10.1" diff --git a/bin/src/qmdl_store.rs b/bin/src/qmdl_store.rs index 510747f..accd7ce 100644 --- a/bin/src/qmdl_store.rs +++ b/bin/src/qmdl_store.rs @@ -203,12 +203,16 @@ impl RecordingStore { #[cfg(test)] mod tests { - use tempdir::TempDir; + use tempfile::{TempDir, Builder}; use super::*; + fn make_temp_dir() -> TempDir { + Builder::new().prefix("qmdl_store_test").tempdir().unwrap() + } + #[tokio::test] async fn test_load_from_empty_dir() { - let dir = TempDir::new("qmdl_store_test").unwrap(); + let dir = make_temp_dir(); assert!(!RecordingStore::exists(dir.path()).await.unwrap()); let _created_store = RecordingStore::create(dir.path()).await.unwrap(); assert!(RecordingStore::exists(dir.path()).await.unwrap()); @@ -218,7 +222,7 @@ mod tests { #[tokio::test] async fn test_creating_updating_and_closing_entries() { - let dir = TempDir::new("qmdl_store_test").unwrap(); + let dir = make_temp_dir(); let mut store = RecordingStore::create(dir.path()).await.unwrap(); let _ = store.new_entry().await.unwrap(); let entry_index = store.current_entry.unwrap(); @@ -237,7 +241,7 @@ mod tests { #[tokio::test] async fn test_repeated_new_entries() { - let dir = TempDir::new("qmdl_store_test").unwrap(); + let dir = make_temp_dir(); let mut store = RecordingStore::create(dir.path()).await.unwrap(); let _ = store.new_entry().await.unwrap(); let entry_index = store.current_entry.unwrap();