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

Removes dependency on rustc_serialize (#5988) #6705

Merged
merged 3 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Cargo.lock

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

7 changes: 4 additions & 3 deletions ethcore/benches/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ extern crate ethcore_util as util;
extern crate rand;
extern crate bn;
extern crate crypto;
extern crate rustc_serialize;
extern crate ethkey;
extern crate rustc_hex;
extern crate ethcore_bigint;

use self::test::{Bencher};
use rand::{StdRng};
Expand Down Expand Up @@ -75,9 +76,9 @@ fn sha256(b: &mut Bencher) {

#[bench]
fn ecrecover(b: &mut Bencher) {
use rustc_serialize::hex::FromHex;
use rustc_hex::FromHex;
use ethkey::{Signature, recover as ec_recover};
use util::H256;
use ethcore_bigint::hash::H256;
let input = FromHex::from_hex("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
let hash = H256::from_slice(&input[0..32]);
let v = H256::from_slice(&input[32..64]);
Expand Down
2 changes: 1 addition & 1 deletion util/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ libc = "0.2.7"
parking_lot = "0.4"
ansi_term = "0.9"
rustc-hex = "1.0"
rustc-serialize = "0.3"
ethcore-io = { path = "../io" }
ethcore-util = { path = ".." }
ethcore-bigint = { path = "../bigint" }
Expand All @@ -34,6 +33,7 @@ path = { path = "../path" }
ethcore-logger = { path ="../../logger" }
ipnetwork = "0.12.6"
hash = { path = "../hash" }
serde_json = "1.0"

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion util/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ extern crate rand;
extern crate time;
extern crate ansi_term; //TODO: remove this
extern crate rustc_hex;
extern crate rustc_serialize;
extern crate igd;
extern crate libc;
extern crate slab;
Expand All @@ -81,6 +80,7 @@ extern crate path;
extern crate ethcore_logger;
extern crate ipnetwork;
extern crate hash;
extern crate serde_json;

#[macro_use]
extern crate log;
Expand Down
6 changes: 3 additions & 3 deletions util/network/src/node_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use error::NetworkError;
use {AllowIP, IpFilter};
use discovery::{TableUpdates, NodeEntry};
use ip_utils::*;
pub use rustc_serialize::json::Json;
use serde_json::Value;

/// Node public key
pub type NodeId = H512;
Expand Down Expand Up @@ -332,7 +332,7 @@ impl NodeTable {
return nodes;
}
}
let json = match Json::from_str(&buf) {
let json: Value = match ::serde_json::from_str(&buf) {
Ok(json) => json,
Err(e) => {
warn!("Error parsing node table file: {:?}", e);
Expand All @@ -341,7 +341,7 @@ impl NodeTable {
};
if let Some(list) = json.as_object().and_then(|o| o.get("nodes")).and_then(|n| n.as_array()) {
for n in list.iter().filter_map(|n| n.as_object()) {
if let Some(url) = n.get("url").and_then(|u| u.as_string()) {
if let Some(url) = n.get("url").and_then(|u| u.as_str()) {
if let Ok(mut node) = Node::from_str(url) {
if let Some(failures) = n.get("failures").and_then(|f| f.as_u64()) {
node.failures = failures as u32;
Expand Down