Skip to content

Commit 5579ca7

Browse files
messenseThomas Bracht Laumann Jespersen
authored and
Thomas Bracht Laumann Jespersen
committed
Use serde_json instead of rustc-serialize
1 parent 6ce0c4a commit 5579ca7

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ diff = "0.1.10"
1919
filetime = "0.1"
2020
getopts = "0.2"
2121
log = "0.3"
22-
rustc-serialize = "0.3"
2322
tempdir = { version = "0.3", optional = true }
23+
serde = "1.0"
24+
serde_json = "1.0"
25+
serde_derive = "1.0"
2426

2527
[target."cfg(unix)".dependencies]
2628
libc = "0.2"

src/json.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
// except according to those terms.
1010

1111
use errors::{Error, ErrorKind};
12-
use rustc_serialize::json;
12+
use serde_json;
1313
use std::str::FromStr;
1414
use std::path::Path;
1515
use runtest::ProcRes;
1616

1717
// These structs are a subset of the ones found in
1818
// `syntax::json`.
1919

20-
#[derive(RustcEncodable, RustcDecodable)]
20+
#[derive(Serialize, Deserialize)]
2121
struct Diagnostic {
2222
message: String,
2323
code: Option<DiagnosticCode>,
@@ -27,7 +27,7 @@ struct Diagnostic {
2727
rendered: Option<String>,
2828
}
2929

30-
#[derive(RustcEncodable, RustcDecodable, Clone)]
30+
#[derive(Serialize, Deserialize, Clone)]
3131
struct DiagnosticSpan {
3232
file_name: String,
3333
line_start: usize,
@@ -40,7 +40,7 @@ struct DiagnosticSpan {
4040
expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
4141
}
4242

43-
#[derive(RustcEncodable, RustcDecodable, Clone)]
43+
#[derive(Serialize, Deserialize, Clone)]
4444
struct DiagnosticSpanMacroExpansion {
4545
/// span where macro was applied to generate this code
4646
span: DiagnosticSpan,
@@ -49,7 +49,7 @@ struct DiagnosticSpanMacroExpansion {
4949
macro_decl_name: String,
5050
}
5151

52-
#[derive(RustcEncodable, RustcDecodable, Clone)]
52+
#[derive(Serialize, Deserialize, Clone)]
5353
struct DiagnosticCode {
5454
/// The code itself.
5555
code: String,
@@ -67,7 +67,7 @@ fn parse_line(file_name: &str, line: &str, output: &str, proc_res: &ProcRes) ->
6767
// The compiler sometimes intermingles non-JSON stuff into the
6868
// output. This hack just skips over such lines. Yuck.
6969
if line.starts_with('{') {
70-
match json::decode::<Diagnostic>(line) {
70+
match serde_json::from_str::<Diagnostic>(line) {
7171
Ok(diagnostic) => {
7272
let mut expected_errors = vec![];
7373
push_expected_errors(&mut expected_errors, &diagnostic, &[], file_name);

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020
extern crate libc;
2121
extern crate test;
2222
extern crate rustc;
23-
extern crate rustc_serialize;
2423

2524
#[cfg(feature = "tmp")] extern crate tempdir;
2625

2726
#[macro_use]
2827
extern crate log;
2928
extern crate filetime;
3029
extern crate diff;
30+
extern crate serde_json;
31+
#[macro_use]
32+
extern crate serde_derive;
3133

3234
use std::env;
3335
use std::ffi::OsString;

0 commit comments

Comments
 (0)