Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

[ethcore]: make it compile without test-helpers feature #11036

Merged
merged 3 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ rand_xorshift = "0.1.1"
rayon = "1.1"
rlp = "0.4.0"
rlp_derive = { path = "../util/rlp-derive" }
rustc-hex = { version = "1", optional = true }
rustc-hex = "1"
niklasad1 marked this conversation as resolved.
Show resolved Hide resolved
serde = "1.0"
serde_derive = "1.0"
snapshot = { path = "snapshot" }
Expand Down Expand Up @@ -93,6 +93,7 @@ rlp_compress = { path = "../util/rlp-compress" }
rustc-hex = "1"
serde_json = "1.0"
stats = { path = "../util/stats" }
pod = { path = "pod" }
tempdir = "0.3"
trie-standardmap = "0.15.0"

Expand Down Expand Up @@ -135,7 +136,6 @@ test-helpers = [
"kvdb-rocksdb",
"macros",
"pod",
"rustc-hex",
"tempdir",
"basic-authority/test-helpers"
]
Expand Down
3 changes: 1 addition & 2 deletions ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern crate patricia_trie_ethereum as ethtrie;
extern crate rand;
extern crate rayon;
extern crate rlp;
extern crate rustc_hex;
extern crate serde;
extern crate snapshot;
extern crate spec;
Expand Down Expand Up @@ -126,8 +127,6 @@ extern crate pod;
extern crate blooms_db;
#[cfg(any(test, feature = "env_logger"))]
extern crate env_logger;
#[cfg(any(test, feature = "test-helpers"))]
extern crate rustc_hex;
#[cfg(test)]
extern crate serde_json;
#[cfg(any(test, feature = "tempdir"))]
Expand Down
30 changes: 16 additions & 14 deletions ethcore/types/src/data_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@ use std::str::FromStr;
/// Format for importing/exporting blocks
#[derive(Debug, PartialEq)]
pub enum DataFormat {
Hex,
Binary,
/// Hexadecimal format
Hex,
/// Binary format
Binary,
}

impl Default for DataFormat {
fn default() -> Self {
DataFormat::Binary
}
fn default() -> Self {
DataFormat::Binary
}
}

impl FromStr for DataFormat {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"binary" | "bin" => Ok(DataFormat::Binary),
"hex" => Ok(DataFormat::Hex),
x => Err(format!("Invalid format: {}", x))
}
}
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"binary" | "bin" => Ok(DataFormat::Binary),
"hex" => Ok(DataFormat::Hex),
x => Err(format!("Invalid format: {}", x))
}
}
}