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

Commit bfff19c

Browse files
authored
Merge pull request #6705 from paritytech/serde-migration
Removes dependency on rustc_serialize (#5988)
2 parents 7029dda + 4f86f5b commit bfff19c

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ethcore/benches/evm.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ extern crate ethcore_util as util;
2121
extern crate rand;
2222
extern crate bn;
2323
extern crate crypto;
24-
extern crate rustc_serialize;
2524
extern crate ethkey;
25+
extern crate rustc_hex;
26+
extern crate ethcore_bigint;
2627

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

7677
#[bench]
7778
fn ecrecover(b: &mut Bencher) {
78-
use rustc_serialize::hex::FromHex;
79+
use rustc_hex::FromHex;
7980
use ethkey::{Signature, recover as ec_recover};
80-
use util::H256;
81+
use ethcore_bigint::hash::H256;
8182
let input = FromHex::from_hex("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
8283
let hash = H256::from_slice(&input[0..32]);
8384
let v = H256::from_slice(&input[32..64]);

util/network/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ libc = "0.2.7"
2121
parking_lot = "0.4"
2222
ansi_term = "0.9"
2323
rustc-hex = "1.0"
24-
rustc-serialize = "0.3"
2524
ethcore-io = { path = "../io" }
2625
ethcore-util = { path = ".." }
2726
ethcore-bigint = { path = "../bigint" }
@@ -34,6 +33,7 @@ path = { path = "../path" }
3433
ethcore-logger = { path ="../../logger" }
3534
ipnetwork = "0.12.6"
3635
hash = { path = "../hash" }
36+
serde_json = "1.0"
3737

3838
[features]
3939
default = []

util/network/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ extern crate rand;
6969
extern crate time;
7070
extern crate ansi_term; //TODO: remove this
7171
extern crate rustc_hex;
72-
extern crate rustc_serialize;
7372
extern crate igd;
7473
extern crate libc;
7574
extern crate slab;
@@ -81,6 +80,7 @@ extern crate path;
8180
extern crate ethcore_logger;
8281
extern crate ipnetwork;
8382
extern crate hash;
83+
extern crate serde_json;
8484

8585
#[macro_use]
8686
extern crate log;

util/network/src/node_table.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use error::NetworkError;
3232
use {AllowIP, IpFilter};
3333
use discovery::{TableUpdates, NodeEntry};
3434
use ip_utils::*;
35-
pub use rustc_serialize::json::Json;
35+
use serde_json::Value;
3636

3737
/// Node public key
3838
pub type NodeId = H512;
@@ -332,7 +332,7 @@ impl NodeTable {
332332
return nodes;
333333
}
334334
}
335-
let json = match Json::from_str(&buf) {
335+
let json: Value = match ::serde_json::from_str(&buf) {
336336
Ok(json) => json,
337337
Err(e) => {
338338
warn!("Error parsing node table file: {:?}", e);
@@ -341,7 +341,7 @@ impl NodeTable {
341341
};
342342
if let Some(list) = json.as_object().and_then(|o| o.get("nodes")).and_then(|n| n.as_array()) {
343343
for n in list.iter().filter_map(|n| n.as_object()) {
344-
if let Some(url) = n.get("url").and_then(|u| u.as_string()) {
344+
if let Some(url) = n.get("url").and_then(|u| u.as_str()) {
345345
if let Ok(mut node) = Node::from_str(url) {
346346
if let Some(failures) = n.get("failures").and_then(|f| f.as_u64()) {
347347
node.failures = failures as u32;

0 commit comments

Comments
 (0)