Replace deprecated tempdir dependency with tempfile (#11588)

`Tempdir` is deprecated, but the functionality has been merged into
another crate: `tempfile`. This commit removes all `tempdir` dependencies
and replaces them with `tempfile` and the equivalent bindings.

Fixes #11560
This commit is contained in:
marktoda
2020-03-29 13:31:17 -07:00
committed by GitHub
parent 4f26ffd447
commit 2a3217d8d8
76 changed files with 220 additions and 214 deletions

View File

@@ -16,6 +16,8 @@
//! Set of different helpers for client tests
extern crate tempfile;
mod test_client;
mod evm_test_client;
@@ -44,7 +46,7 @@ use kvdb::KeyValueDB;
use kvdb_rocksdb::{self, Database, DatabaseConfig};
use parking_lot::RwLock;
use rlp::{self, RlpStream};
use tempdir::TempDir;
use self::tempfile::TempDir;
use types::{
chain_notify::ChainMessageType,
transaction::{Action, Transaction, SignedTransaction},
@@ -305,8 +307,8 @@ impl BlockChainDB for TestBlockChainDB {
/// Creates new test instance of `BlockChainDB`
pub fn new_db() -> Arc<dyn BlockChainDB> {
let blooms_dir = TempDir::new("").unwrap();
let trace_blooms_dir = TempDir::new("").unwrap();
let blooms_dir = TempDir::new().unwrap();
let trace_blooms_dir = TempDir::new().unwrap();
let db = TestBlockChainDB {
blooms: blooms_db::Database::open(blooms_dir.path()).unwrap(),
@@ -321,8 +323,8 @@ pub fn new_db() -> Arc<dyn BlockChainDB> {
/// Creates a new temporary `BlockChainDB` on FS
pub fn new_temp_db(tempdir: &Path) -> Arc<dyn BlockChainDB> {
let blooms_dir = TempDir::new("").unwrap();
let trace_blooms_dir = TempDir::new("").unwrap();
let blooms_dir = TempDir::new().unwrap();
let trace_blooms_dir = TempDir::new().unwrap();
let key_value_dir = tempdir.join("key_value");
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);