Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit a511027

Browse files
committed
rls-analysis: Use serde exclusively
1 parent 01d65f1 commit a511027

File tree

3 files changed

+7
-35
lines changed

3 files changed

+7
-35
lines changed

rls-analysis/Cargo.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,20 @@ exclude = [
1111
]
1212

1313
[dependencies]
14-
rustc-serialize = { version = "0.3", optional = true }
1514
log = "0.4"
16-
rls-data = "= 0.18.2"
17-
rls-span = "0.4"
15+
rls-data = "= 0.19"
16+
rls-span = "0.5"
1817
derive-new = "0.5"
1918
fst = { version = "0.3", default-features = false }
2019
itertools = "0.7.3"
2120
json = "0.11.13"
22-
serde = { version = "1.0", optional = true }
23-
serde_json = { version = "1.0", optional = true }
21+
serde = "1.0"
22+
serde_json = "1.0"
2423

2524
[dev-dependencies]
2625
lazy_static = "1"
2726
env_logger = "0.5"
2827

2928
[features]
30-
default = ["serialize-rustc"]
31-
serialize-rustc = ["rustc-serialize", "rls-data/serialize-rustc", "rls-span/serialize-rustc"]
32-
serialize-serde = ["serde", "serde_json", "rls-data/serialize-serde", "rls-span/serialize-serde"]
29+
default = []
30+
derive = ["rls-data/derive", "rls-span/derive"]

rls-analysis/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ extern crate itertools;
1515
extern crate json;
1616
extern crate rls_data as data;
1717
extern crate rls_span as span;
18-
#[cfg(feature = "serialize-rustc")]
19-
extern crate rustc_serialize;
20-
#[cfg(feature = "serialize-serde")]
2118
extern crate serde;
22-
#[cfg(feature = "serialize-serde")]
2319
extern crate serde_json;
2420

2521
mod analysis;

rls-analysis/src/raw.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn read_crate_data(path: &Path) -> Option<Analysis> {
122122
Err(err)
123123
})
124124
.ok()?;
125-
let s = decode_buf(&buf)
125+
let s = ::serde_json::from_str(&buf)
126126
.or_else(|err| {
127127
warn!("deserialisation error: {:?}", err);
128128
json::parse(&buf)
@@ -156,28 +156,6 @@ fn read_crate_data(path: &Path) -> Option<Analysis> {
156156
s
157157
}
158158

159-
#[cfg(all(feature = "serialize-rustc", not(feature = "serialize-serde")))]
160-
fn decode_buf(buf: &str) -> Result<Option<Analysis>, rustc_serialize::json::DecoderError> {
161-
::rustc_serialize::json::decode(buf)
162-
}
163-
164-
#[cfg(all(feature = "serialize-serde", not(feature = "serialize-rustc")))]
165-
fn decode_buf(buf: &str) -> Result<Option<Analysis>, serde_json::Error> {
166-
::serde_json::from_str(buf)
167-
}
168-
169-
#[cfg(all(feature = "serialize-rustc", feature = "serialize-serde"))]
170-
fn decode_buf(buf: &str) -> Result<Option<Analysis>, Box<dyn std::error::Error>> {
171-
compile_error!("Features \"serialize-serde\" and \"serialize-rustc\" cannot both be enabled for this crate.")
172-
}
173-
174-
#[cfg(not(any(feature = "serialize-serde", feature = "serialize-rustc")))]
175-
fn decode_buf(buf: &str) -> Result<Option<Analysis>, Box<dyn std::error::Error>> {
176-
compile_error!(
177-
"Either feature \"serialize-serde\" or \"serialize-rustc\" must be enabled for this crate."
178-
)
179-
}
180-
181159
pub fn name_space_for_def_kind(dk: DefKind) -> char {
182160
match dk {
183161
DefKind::Enum

0 commit comments

Comments
 (0)