diff --git a/Cargo.lock b/Cargo.lock index c87846e..ad067b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,7 +109,7 @@ dependencies = [ "pretty_assertions", "serde", "serde_json", - "tempdir", + "tempfile", "tokio", "toml", "tower-lsp", @@ -177,6 +177,22 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -186,12 +202,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" version = "0.3.31" @@ -269,6 +279,17 @@ dependencies = [ "slab", ] +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "gimli" version = "0.31.1" @@ -460,6 +481,12 @@ version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "litemap" version = "0.7.4" @@ -618,43 +645,6 @@ 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_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 = "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.5.8" @@ -708,15 +698,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" -[[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 = "rust-fuzzy-search" version = "0.1.1" @@ -729,6 +710,19 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustix" +version = "0.38.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" +dependencies = [ + "bitflags 2.8.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.18" @@ -855,13 +849,17 @@ dependencies = [ ] [[package]] -name = "tempdir" -version = "0.3.7" +name = "tempfile" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ - "rand", - "remove_dir_all", + "cfg-if", + "fastrand", + "getrandom", + "once_cell", + "rustix", + "windows-sys", ] [[package]] @@ -1100,28 +1098,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index c98f6de..72e3f82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,4 +40,4 @@ tracing-subscriber = { version = "0.3.19", default-features = false, features = [dev-dependencies] pretty_assertions = "1.4.1" -tempdir = "0.3.7" +tempfile = "3.15.0" diff --git a/src/bacon.rs b/src/bacon.rs index 6feab49..2de15f2 100644 --- a/src/bacon.rs +++ b/src/bacon.rs @@ -196,7 +196,7 @@ mod tests { use std::io::Write; use super::*; - use tempdir::TempDir; + use tempfile::TempDir; #[tokio::test] async fn test_valid_bacon_preferences() { @@ -213,7 +213,7 @@ mod tests { path = "{LOCATIONS_FILE}" "# ); - let tmp_dir = TempDir::new("bacon").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join("prefs.toml"); let mut file = std::fs::File::create(&file_path).unwrap(); write!(file, "{}", valid_toml).unwrap(); @@ -236,7 +236,7 @@ mod tests { "# ); - let tmp_dir = TempDir::new("bacon").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join("prefs.toml"); let mut file = std::fs::File::create(&file_path).unwrap(); write!(file, "{}", invalid_toml).unwrap(); @@ -259,7 +259,7 @@ mod tests { "# ); - let tmp_dir = TempDir::new("bacon").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join("prefs.toml"); let mut file = std::fs::File::create(&file_path).unwrap(); write!(file, "{}", invalid_toml).unwrap(); @@ -300,7 +300,7 @@ mod tests { #[tokio::test] async fn test_file_write_failure() { - let tmp_dir = TempDir::new("bacon").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join("prefs.toml"); // Simulate write failure by closing the file prematurely let file = File::create(&file_path).await.unwrap(); @@ -311,7 +311,7 @@ mod tests { #[tokio::test] async fn test_empty_bacon_preferences_file() { - let tmp_dir = TempDir::new("bacon").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join("empty_prefs.toml"); std::fs::File::create(&file_path).unwrap(); assert!(Bacon::validate_preferences_file(&file_path).await.is_err()); diff --git a/src/lib.rs b/src/lib.rs index 0b30420..d0f7f2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -378,7 +378,7 @@ mod tests { use super::*; use pretty_assertions::assert_eq; - use tempdir::TempDir; + use tempfile::TempDir; const ERROR_LINE: &str = "error|:|/app/github/bacon-ls/src/lib.rs|:|352|:|352|:|9|:|20|:|cannot find value `one` in this scope\n |\n352 | one\n | ^^^ help: a unit variant with a similar name exists: `None`\n |\n ::: /Users/matteobigoi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:576:5\n |\n576 | None,\n | ---- similarly named unit variant `None` defined here\n\nFor more information about this error, try `rustc --explain E0425`.\nerror: could not compile `bacon-ls` (lib) due to 1 previous error|:|none"; @@ -433,7 +433,7 @@ error: could not compile `bacon-ls` (lib) due to 1 previous error"# #[cfg(not(target_os = "windows"))] #[tokio::test] async fn test_multiline_diagnostics_production() { - let tmp_dir = TempDir::new("bacon-ls").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join(".bacon-locations"); let mut tmp_file = std::fs::File::create(file_path).unwrap(); let error_path = format!("{}/src/lib.rs", tmp_dir.path().display()); @@ -505,7 +505,7 @@ error: could not compile `bacon-ls` (lib) due to 1 previous error"# #[cfg(not(target_os = "windows"))] #[tokio::test] async fn test_diagnostics_production_and_deduplication() { - let tmp_dir = TempDir::new("bacon-ls").unwrap(); + let tmp_dir = TempDir::new().unwrap(); let file_path = tmp_dir.path().join(".bacon-locations"); let mut tmp_file = std::fs::File::create(file_path).unwrap(); let error_path = format!("{}/src/lib.rs", tmp_dir.path().display());