From c162a4516cc818ef1221a59eed2f3fc4060b4746 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 22 Nov 2019 11:08:12 +0000 Subject: [PATCH] Replace deprecated tempdir with tempfile This also removes one dependency on the winapi crate. The current version of the time crate also depends on winapi, but work is being done to replace that version with 0.2 to remove the winapi dependency. --- Cargo.toml | 2 +- src/busy.rs | 8 ++++---- src/lib.rs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5a617b5..74a3426 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,7 +72,7 @@ memchr = "2.2.0" uuid = { version = "0.8", optional = true } [dev-dependencies] -tempdir = "0.3" +tempfile = "3.1.0" lazy_static = "1.0" regex = "1.0" uuid = { version = "0.8", features = ["v4"] } diff --git a/src/busy.rs b/src/busy.rs index 1165f3b..fd0f949 100644 --- a/src/busy.rs +++ b/src/busy.rs @@ -79,13 +79,13 @@ mod test { use std::sync::mpsc::sync_channel; use std::thread; use std::time::Duration; - use tempdir::TempDir; + use tempfile; use crate::{Connection, Error, ErrorCode, Result, TransactionBehavior, NO_PARAMS}; #[test] fn test_default_busy() { - let temp_dir = TempDir::new("test_default_busy").unwrap(); + let temp_dir = tempfile::tempdir().unwrap(); let path = temp_dir.path().join("test.db3"); let mut db1 = Connection::open(&path).unwrap(); @@ -106,7 +106,7 @@ mod test { #[test] #[ignore] // FIXME: unstable fn test_busy_timeout() { - let temp_dir = TempDir::new("test_busy_timeout").unwrap(); + let temp_dir = tempfile::tempdir().unwrap(); let path = temp_dir.path().join("test.db3"); let db2 = Connection::open(&path).unwrap(); @@ -145,7 +145,7 @@ mod test { true } - let temp_dir = TempDir::new("test_busy_handler").unwrap(); + let temp_dir = tempfile::tempdir().unwrap(); let path = temp_dir.path().join("test.db3"); let db2 = Connection::open(&path).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index bf7c1c9..1c8f9bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -869,7 +869,7 @@ mod test { use fallible_iterator::FallibleIterator; use std::error::Error as StdError; use std::fmt; - use tempdir::TempDir; + use tempfile; // this function is never called, but is still type checked; in // particular, calls with specific instantiations will require @@ -892,7 +892,7 @@ mod test { #[test] fn test_concurrent_transactions_busy_commit() { use std::time::Duration; - let tmp = TempDir::new("locked").unwrap(); + let tmp = tempfile::tempdir().unwrap(); let path = tmp.path().join("transactions.db3"); Connection::open(&path) @@ -938,7 +938,7 @@ mod test { #[test] fn test_persistence() { - let temp_dir = TempDir::new("test_open_file").unwrap(); + let temp_dir = tempfile::tempdir().unwrap(); let path = temp_dir.path().join("test.db3"); {