diff --git a/app/gui/controller/engine-protocol/Cargo.toml b/app/gui/controller/engine-protocol/Cargo.toml index 20b44231b78..ce49c07d3e8 100644 --- a/app/gui/controller/engine-protocol/Cargo.toml +++ b/app/gui/controller/engine-protocol/Cargo.toml @@ -11,10 +11,7 @@ crate-type = ["cdylib", "rlib"] chrono = { version = "0.4", features = ["serde"] } enso-data-structures = { path = "../../../../lib/rust/data-structures" } enso-logger = { path = "../../../../lib/rust/logger" } -enso-prelude = { path = "../../../../lib/rust/prelude", features = [ - "serde", - "serde_json" -] } +enso-prelude = { path = "../../../../lib/rust/prelude" } enso-shapely = { path = "../../../../lib/rust/shapely" } enso-text = { path = "../../../../lib/rust/text" } failure = { version = "0.1.8" } diff --git a/app/gui/language/parser/Cargo.toml b/app/gui/language/parser/Cargo.toml index 3458b005d85..2fa821e97d7 100644 --- a/app/gui/language/parser/Cargo.toml +++ b/app/gui/language/parser/Cargo.toml @@ -11,10 +11,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] ast = { path = "../ast/impl" } enso-data-structures = { path = "../../../../lib/rust/data-structures" } -enso-prelude = { path = "../../../../lib/rust/prelude", features = [ - "serde", - "serde_json" -] } +enso-prelude = { path = "../../../../lib/rust/prelude" } enso-profiler = { path = "../../../../lib/rust/profiler" } enso-text = { path = "../../../../lib/rust/text" } console_error_panic_hook = { version = "0.1.6" } diff --git a/app/gui/view/graph-editor/Cargo.toml b/app/gui/view/graph-editor/Cargo.toml index 3afad14fdcf..2838afb40a8 100644 --- a/app/gui/view/graph-editor/Cargo.toml +++ b/app/gui/view/graph-editor/Cargo.toml @@ -15,7 +15,7 @@ bimap = { version = "0.4.0" } enso-config = { version = "0.1.0", path = "../../config" } enso-frp = { version = "0.1.0", path = "../../../../lib/rust/frp" } enso-logger = { path = "../../../../lib/rust/logger" } -enso-prelude = { path = "../../../../lib/rust/prelude", features = ["serde"] } +enso-prelude = { path = "../../../../lib/rust/prelude" } engine-protocol = { version = "0.1.0", path = "../../controller/engine-protocol" } enso-shapely = { path = "../../../../lib/rust/shapely" } enso-text = { version = "0.1.0", path = "../../../../lib/rust/text" } diff --git a/lib/rust/json-rpc/Cargo.toml b/lib/rust/json-rpc/Cargo.toml index fe8e9b0fb8f..cf3bee07601 100644 --- a/lib/rust/json-rpc/Cargo.toml +++ b/lib/rust/json-rpc/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -enso-prelude = { path = "../prelude", features = ["futures"] } +enso-prelude = { path = "../prelude" } enso-shapely = { path = "../shapely" } enso-web = { path = "../web" } enso-profiler-data = { path = "../profiler/data" } diff --git a/lib/rust/parser/Cargo.toml b/lib/rust/parser/Cargo.toml index 1a2c2591b2e..e46d7fd4f43 100644 --- a/lib/rust/parser/Cargo.toml +++ b/lib/rust/parser/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/enso-org/enso" license-file = "../../LICENSE" [dependencies] -enso-prelude = { path = "../prelude", features = ["serde", "serde_json"] } +enso-prelude = { path = "../prelude" } enso-reflect = { path = "../reflect" } enso-data-structures = { path = "../data-structures" } enso-types = { path = "../types" } diff --git a/lib/rust/parser/generate-java/Cargo.toml b/lib/rust/parser/generate-java/Cargo.toml index 880315d782a..53069e6e717 100644 --- a/lib/rust/parser/generate-java/Cargo.toml +++ b/lib/rust/parser/generate-java/Cargo.toml @@ -11,7 +11,7 @@ license-file = "../../LICENSE" [dependencies] enso-metamodel = { path = "../../metamodel", features = ["rust", "java"] } -enso-prelude = { path = "../../prelude", features = ["serde"] } +enso-prelude = { path = "../../prelude" } enso-parser = { path = ".." } enso-reflect = { path = "../../reflect", features = ["graphviz"] } derivative = "2.2" diff --git a/lib/rust/prelude/Cargo.toml b/lib/rust/prelude/Cargo.toml index ea2f1efd93a..cb63489e424 100644 --- a/lib/rust/prelude/Cargo.toml +++ b/lib/rust/prelude/Cargo.toml @@ -28,7 +28,7 @@ derivative = "2.2.0" derive_more = "0.99" enclose = "1.1.8" failure = "0.1.5" -futures = { version = "0.3.1", optional = true } +futures = { version = "0.3.1" } ifmt = "0.3.3" itertools = "0.10.0" lazy_static = "1.4" @@ -36,13 +36,13 @@ num = "0.4.0" object = { version = "0.24.0" } paste = "1.0" shrinkwraprs = "0.3.0" -serde = { version = "1.0.126", features = ["derive", "rc"], optional = true } -serde_json = { version = "1.0", optional = true } +serde = { version = "1.0.126", features = ["derive", "rc"] } +serde_json = { version = "1.0" } smallvec = "1.0.0" tracing = { version = "0.1.37", features = ["log"] } tracing-subscriber = "0.3" tracing-wasm = "0.2" -wasm-bindgen = { version = "0.2.78", features = ["nightly"], optional = true } +wasm-bindgen = { version = "0.2.78", features = ["nightly"] } weak-table = "0.3.0" enso-web = { path = "../web" } gen-iter = "0.2.1" diff --git a/lib/rust/prelude/src/data/non_empty_vec.rs b/lib/rust/prelude/src/data/non_empty_vec.rs index 712a302177c..6bf2079d41c 100644 --- a/lib/rust/prelude/src/data/non_empty_vec.rs +++ b/lib/rust/prelude/src/data/non_empty_vec.rs @@ -18,8 +18,8 @@ use std::vec::Drain; #[allow(missing_docs)] #[derive(Clone, Debug, Eq, PartialEq, Deref, DerefMut, Reflect)] #[reflect(transparent)] -#[cfg_attr(feature = "serde", derive(crate::serde_reexports::Serialize))] -#[cfg_attr(feature = "serde", derive(crate::serde_reexports::Deserialize))] +#[derive(crate::serde_reexports::Serialize)] +#[derive(crate::serde_reexports::Deserialize)] pub struct NonEmptyVec { #[reflect(as = "Vec")] pub elems: VecIndexedBy, diff --git a/lib/rust/prelude/src/data/vec_indexed_by.rs b/lib/rust/prelude/src/data/vec_indexed_by.rs index 773931c0dfb..a813154b922 100644 --- a/lib/rust/prelude/src/data/vec_indexed_by.rs +++ b/lib/rust/prelude/src/data/vec_indexed_by.rs @@ -34,8 +34,8 @@ macro_rules! ranged_fn { pub trait Index = Copy + From + Into; -#[cfg_attr(feature = "serde", derive(crate::serde_reexports::Serialize))] -#[cfg_attr(feature = "serde", derive(crate::serde_reexports::Deserialize))] +#[derive(crate::serde_reexports::Serialize)] +#[derive(crate::serde_reexports::Deserialize)] #[derive(Derivative, Deref, DerefMut, From, Into)] #[derivative(Clone(bound = "T: Clone, A: Allocator + Clone"))] #[derivative(Debug(bound = "T: Debug, A: Allocator"))] @@ -43,13 +43,10 @@ pub trait Index = Copy + From + Into; #[derivative(PartialEq(bound = "Vec: PartialEq"))] #[derivative(Eq(bound = "Vec: PartialEq"))] pub struct VecIndexedBy { - #[cfg_attr( - feature = "serde", - serde(bound( - serialize = "Vec: crate::serde_reexports::Serialize", - deserialize = "Vec: crate::serde_reexports::Deserialize<'de>" - )) - )] + #[serde(bound( + serialize = "Vec: crate::serde_reexports::Serialize", + deserialize = "Vec: crate::serde_reexports::Deserialize<'de>" + ))] #[deref] #[deref_mut] vec: Vec, diff --git a/lib/rust/prelude/src/lib.rs b/lib/rust/prelude/src/lib.rs index 82b62623af0..d3dcab1c601 100644 --- a/lib/rust/prelude/src/lib.rs +++ b/lib/rust/prelude/src/lib.rs @@ -24,14 +24,12 @@ #![recursion_limit = "256"] mod bool; -#[cfg(feature = "futures")] pub mod channel; mod collections; mod data; pub mod debug; pub mod env; mod fail; -#[cfg(feature = "futures")] pub mod future; mod leak; mod macros; @@ -42,7 +40,6 @@ mod range; mod rc; mod reference; mod result; -#[cfg(feature = "serde")] mod serde; mod smallvec; mod std_reexports; @@ -54,7 +51,6 @@ mod vec; mod wrapper; pub use crate::bool::*; -#[cfg(feature = "serde")] pub use crate::serde::*; pub use crate::smallvec::*; pub use anyhow; @@ -133,7 +129,6 @@ pub mod std_ext { /// /// They cannot be directly reexported from prelude, as the methods `serialize` and `deserialize` /// that would be brought into scope by this, would collide with the other IDE-defined traits. -#[cfg(feature = "serde")] pub mod serde_reexports { pub use serde::Deserialize; pub use serde::Serialize; diff --git a/lib/rust/prelude/src/serde.rs b/lib/rust/prelude/src/serde.rs index 471278746e2..97d22cb7d97 100644 --- a/lib/rust/prelude/src/serde.rs +++ b/lib/rust/prelude/src/serde.rs @@ -1,13 +1,11 @@ //! Module for utilities related to serialization/deserialization using the `serde` library. -#[cfg(feature = "serde_json")] use serde::Deserialize; /// Try to deserialize value of type `Ret`. In case of any error, it is ignored and the default /// value is returned instead. -#[cfg(feature = "serde_json")] pub fn deserialize_or_default<'d, Ret, D>(d: D) -> Result where for<'e> Ret: Default + Deserialize<'e>, @@ -41,7 +39,6 @@ where /// check_deserialized_eq(r#"{"blah" : [] }"#, &empty_foo); /// check_deserialized_eq(r#"{"blah" : [1,2,3] }"#, &Foo { blah: vec![1, 2, 3] }); /// ``` -#[cfg(feature = "serde_json")] pub fn deserialize_null_as_default<'d, Ret, D>(d: D) -> Result where for<'e> Ret: Default + Deserialize<'e>, diff --git a/lib/rust/prelude/src/string.rs b/lib/rust/prelude/src/string.rs index e3088e0e8f1..f74ce1646f3 100644 --- a/lib/rust/prelude/src/string.rs +++ b/lib/rust/prelude/src/string.rs @@ -7,9 +7,7 @@ use itertools::*; use crate::impls; -#[cfg(feature = "serde")] use serde::Deserialize; -#[cfg(feature = "serde")] use serde::Serialize; use std::borrow::Cow; use std::ops::Deref; @@ -102,7 +100,7 @@ impl AsRef for CowString { /// Immutable string implementation with a fast clone implementation. #[derive(Clone, CloneRef, Default, Eq, Hash, PartialEq, Ord, PartialOrd)] -#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] +#[derive(Deserialize, Serialize)] pub struct ImString { content: Rc, } @@ -286,16 +284,6 @@ impl ToImString for &str { // === Macros === /// Defines a newtype for `ImString`. -#[cfg(not(feature = "serde"))] -#[macro_export] -macro_rules! im_string_newtype { - ($($(#$meta:tt)* $name:ident),* $(,)?) => { - im_string_newtype_without_serde!{ $($(#$meta)* $name),* } - }; -} - -/// Defines a newtype for `ImString`. -#[cfg(feature = "serde")] #[macro_export] macro_rules! im_string_newtype { ($($(#$meta:tt)* $name:ident),* $(,)?) => { diff --git a/lib/rust/prelude/src/test.rs b/lib/rust/prelude/src/test.rs index 6084b907874..45f3b149bd6 100644 --- a/lib/rust/prelude/src/test.rs +++ b/lib/rust/prelude/src/test.rs @@ -5,20 +5,15 @@ // === Export === // ============== -#[cfg(feature = "futures")] pub mod future; -#[cfg(feature = "futures")] pub mod stream; /// Traits providing helper methods for test code. pub mod traits { - #[cfg(feature = "futures")] pub use super::future::FutureResultTestExt; - #[cfg(feature = "futures")] pub use super::future::FutureTestExt; - #[cfg(feature = "futures")] pub use super::stream::StreamTestExt; pub use super::ExpectTuple; } diff --git a/lib/rust/types/Cargo.toml b/lib/rust/types/Cargo.toml index 1c4ea450833..f1a8e938234 100644 --- a/lib/rust/types/Cargo.toml +++ b/lib/rust/types/Cargo.toml @@ -11,7 +11,7 @@ enso-reflect = { path = "../reflect" } nalgebra = { version = "0.26.1" } num-traits = { version = "0.2" } paste = "1.0.7" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", features = ["derive"] } enso-prelude = { path = "../prelude" } [build-dependencies] diff --git a/lib/rust/types/src/unit2.rs b/lib/rust/types/src/unit2.rs index 3a4465d4f7f..88b4bbacc78 100644 --- a/lib/rust/types/src/unit2.rs +++ b/lib/rust/types/src/unit2.rs @@ -97,7 +97,7 @@ pub trait Variant { /// Internal representation of every unit. #[repr(transparent)] #[derive(Reflect)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(serde::Serialize, serde::Deserialize)] #[reflect(transparent)] pub struct UnitData { repr: R, @@ -520,7 +520,7 @@ macro_rules! define { pub type $name = $crate::unit2::Unit<[<$name:snake:upper>]>; $(#$meta)* #[derive(Debug, Clone, Copy, Reflect)] - #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] + #[derive(serde::Serialize, serde::Deserialize)] pub struct [<$name:snake:upper>]; impl $crate::unit2::Variant for [<$name:snake:upper>] {