Skip to content

Commit

Permalink
Remove tempfile as a dependency
Browse files Browse the repository at this point in the history
See BurntSushi/quickcheck#241 : tempfile depends on an antiquated rand
  • Loading branch information
huitseeker committed Sep 6, 2019
1 parent ab6e440 commit aa1f555
Show file tree
Hide file tree
Showing 39 changed files with 237 additions and 148 deletions.
70 changes: 24 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ protobuf = "~2.7"
rand = "0.7.0"
regex = "1.2.1"
structopt = "0.2.15"
tempdir = "0.3.7"
num_cpus = "1.10.1"

admission_control_proto = { path = "../admission_control/admission_control_proto" }
Expand All @@ -30,6 +29,7 @@ metrics = { path = "../common/metrics" }
crypto = { path = "../crypto/crypto" }
proto_conv = { path = "../common/proto_conv" }
rusty-fork = "0.2.1"
tools = { path = "../common/tools" }
types = { path = "../types" }
vm_genesis = { path = "../language/vm/vm_genesis" }

Expand Down
6 changes: 3 additions & 3 deletions benchmark/src/bin/ruben.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ mod tests {
use libra_swarm::swarm::LibraSwarm;
use rusty_fork::{rusty_fork_id, rusty_fork_test, rusty_fork_test_name};
use std::ops::Range;
use tempdir::TempDir;
use tools::tempdir::TempPath;

/// Start libra_swarm and create a BenchOpt struct for testing.
/// Must return the TempDir otherwise it will be freed somehow.
fn start_swarm_and_setup_arguments() -> (LibraSwarm, BenchOpt, Option<TempDir>) {
/// Must return the TempPath otherwise it will be freed somehow.
fn start_swarm_and_setup_arguments() -> (LibraSwarm, BenchOpt, Option<TempPath>) {
let (faucet_account_keypair, faucet_key_file_path, temp_dir) =
generate_keypair::load_faucet_key_or_create_default(None);
let topology = LibraSwarmTopology::create_validator_network(4);
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ num-traits = "0.2"
serde = { version = "1.0.96", features = ["derive"] }
serde_json = "1.0.40"
structopt = "0.2.15"
tempfile = "3.1.0"

admission_control_proto = { version = "0.1.0", path = "../admission_control/admission_control_proto" }
config = { path = "../config" }
Expand All @@ -33,6 +32,7 @@ logger = { path = "../common/logger" }
metrics = { path = "../common/metrics" }
proto_conv = { path = "../common/proto_conv" }
types = { path = "../types" }
tools = { path = "../common/tools/" }
vm_genesis = { path = "../language/vm/vm_genesis" }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/libra_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ path = "../../common/failure_ext"
package = "failure_ext"

[dev-dependencies]
tempfile = "3.1.0"
types = { path = "../../types", features = ["testing"]}
tools = { path = "../../common/tools"}
6 changes: 3 additions & 3 deletions client/libra_wallet/src/mnemonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::{
};

#[cfg(test)]
use tempfile::NamedTempFile;
use tools::tempdir::TempPath;

/// Mnemonic seed for deterministic key derivation based on [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).
/// The mnemonic must encode entropy in a multiple of 32 bits. With more entropy, security is
Expand Down Expand Up @@ -447,8 +447,8 @@ fn test_roundtrip_mnemonic() {
let mut rng = EntropyRng::new();
let mut buf = [0u8; 32];
rng.fill_bytes(&mut buf[..]);
let file = NamedTempFile::new().unwrap();
let path = file.into_temp_path();
let file = TempPath::new();
let path = file.path();
let mnemonic = Mnemonic::mnemonic(&buf[..]).unwrap();
mnemonic.write(&path).unwrap();
let other_mnemonic = Mnemonic::read(&path).unwrap();
Expand Down
Loading

0 comments on commit aa1f555

Please sign in to comment.