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

@@ -1171,7 +1171,7 @@ mod tests {
use std::fs::File;
use std::str::FromStr;
use tempdir::TempDir;
use tempfile::TempDir;
use ethcore::miner::MinerOptions;
use miner::pool::PrioritizationStrategy;
use parity_rpc::NetworkSettings;
@@ -1620,7 +1620,7 @@ mod tests {
#[test]
fn should_not_bail_on_empty_line_in_reserved_peers() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let filename = tempdir.path().join("peers");
File::create(&filename).unwrap().write_all(b" \n\t\n").unwrap();
let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()];
@@ -1630,7 +1630,7 @@ mod tests {
#[test]
fn should_ignore_comments_in_reserved_peers() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let filename = tempdir.path().join("peers_comments");
File::create(&filename).unwrap().write_all(b"# Sample comment\nenode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@172.0.0.1:30303\n").unwrap();
let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()];

View File

@@ -19,7 +19,7 @@ extern crate migration_rocksdb;
extern crate ethcore_blockchain;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
use std::{io, fs};
use std::sync::Arc;

View File

@@ -350,7 +350,7 @@ mod tests {
use std::fs::File;
use std::io::Write;
use std::collections::HashSet;
use tempdir::TempDir;
use tempfile::TempDir;
use ethereum_types::U256;
use ethcore::miner::PendingSet;
use ethkey::Password;
@@ -445,7 +445,7 @@ mod tests {
#[test]
fn test_password() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("file");
let mut file = File::create(&path).unwrap();
file.write_all(b"a bc ").unwrap();
@@ -454,7 +454,7 @@ mod tests {
#[test]
fn test_password_multiline() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("file");
let mut file = File::create(path.as_path()).unwrap();
file.write_all(br#" password with trailing whitespace

View File

@@ -96,7 +96,7 @@ extern crate ethcore_call_contract as call_contract;
extern crate pretty_assertions;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
mod account;
mod account_utils;