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

Commit ccee212

Browse files
committed
Don't use serde_derive hack in rls-* crates
1 parent 288260a commit ccee212

File tree

10 files changed

+25
-12108
lines changed

10 files changed

+25
-12108
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test = false
2121
path = "rls/src/main.rs"
2222

2323
[dependencies]
24-
rls-analysis = "0.18.0"
24+
rls-analysis = "0.18.1"
2525
rls-data = "0.19"
2626
# FIXME: Release rls-rustc 0.6.0 to crates.io
2727
rls-rustc = { version = "0.6.0", path = "rls-rustc" }

rls-data/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rls-data"
3-
version = "0.19.0"
3+
version = "0.19.1"
44
edition = "2018"
55
authors = ["Nick Cameron <[email protected]>"]
66
description = "Data structures used by the RLS and Rust compiler"
@@ -11,8 +11,7 @@ categories = ["development-tools"]
1111
[dependencies]
1212
rls-span = "0.5.0"
1313
serde = "1.0"
14-
serde_derive = { version = "1.0", optional = true }
1514

1615
[features]
17-
default = []
18-
derive = ["serde_derive", "rls-span/derive"]
16+
default = ["derive"]
17+
derive = ["serde/derive", "rls-span/derive"]

rls-data/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#[cfg(feature = "derive")]
2+
use serde::{Deserialize, Serialize};
3+
14
/// Used to configure save-analysis.
25
#[derive(Debug, Clone, Default)]
36
#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]

rls-data/src/lib.rs

Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
use rls_span as span;
22

3+
use std::path::PathBuf;
4+
35
#[cfg(feature = "derive")]
4-
#[macro_use]
5-
extern crate serde_derive;
6+
use serde::{Deserialize, Serialize};
67

78
pub mod config;
8-
mod serde_expanded;
9-
10-
use std::path::PathBuf;
11-
129
pub use config::Config;
1310

1411
#[derive(Debug, Clone, Default)]
@@ -273,73 +270,3 @@ pub struct SigElement {
273270
pub start: usize,
274271
pub end: usize,
275272
}
276-
277-
// Following macros are copied from the `static-assertions` library:
278-
// https://github.com/nvzqz/static-assertions-rs/blob/9f0f8aa871390f74f2afcdba53c1e02db90b2d17/src/assert_impl.rs
279-
#[macro_export(local_inner_macros)]
280-
macro_rules! assert_impl {
281-
($($xs:tt)+) => { _assert_impl!($($xs)+); };
282-
}
283-
284-
#[doc(hidden)]
285-
#[macro_export(local_inner_macros)]
286-
macro_rules! _assert_impl {
287-
($x:ty, $($t:path),+ $(,)*) => {
288-
{
289-
fn assert_impl<'hidden, T>() where T: ?Sized $(+ $t)+ {}
290-
assert_impl::<$x>();
291-
}
292-
};
293-
($label:ident; $($xs:tt)+) => {
294-
#[allow(dead_code, non_snake_case)]
295-
fn $label() { assert_impl!($($xs)+); }
296-
};
297-
}
298-
299-
#[doc(hidden)]
300-
macro_rules! assert_serde {
301-
($($typ:path),* $(,)*) => {
302-
$( assert_impl!($typ, Serialize, Deserialize<'hidden>); )*
303-
};
304-
}
305-
306-
/// Since we manually provide impls in `cfg(not(feature = "derive"))`, it's good
307-
/// to ensure that the types actually implement all the required traits.
308-
#[doc(hidden)]
309-
fn _assertions() {
310-
use serde::{Deserialize, Serialize};
311-
312-
assert_serde!(
313-
// rls-data
314-
Analysis,
315-
Id,
316-
GlobalCrateId,
317-
SpanData,
318-
CompilationOptions,
319-
CratePreludeData,
320-
ExternalCrateData,
321-
Import,
322-
Def,
323-
Impl,
324-
Attribute,
325-
Ref,
326-
MacroRef,
327-
Relation,
328-
Signature,
329-
SigElement,
330-
Config,
331-
// rls-span
332-
span::Column<span::ZeroIndexed>,
333-
span::Location<span::ZeroIndexed>,
334-
span::Position<span::ZeroIndexed>,
335-
span::Range<span::ZeroIndexed>,
336-
span::Row<span::ZeroIndexed>,
337-
span::Span<span::ZeroIndexed>,
338-
span::Column<span::OneIndexed>,
339-
span::Location<span::OneIndexed>,
340-
span::Position<span::OneIndexed>,
341-
span::Range<span::OneIndexed>,
342-
span::Row<span::OneIndexed>,
343-
span::Span<span::OneIndexed>,
344-
);
345-
}

0 commit comments

Comments
 (0)