From 497054a72181b94721e5635a91f3bcab84658a8c Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 23 Jul 2023 12:01:31 +0200 Subject: [PATCH 1/2] history: Fix required feature set of serde dependency The state module uses Serialize and Deserialize as derive macros, but those are only available with the derive feature. --- crates/history/Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/history/Cargo.toml b/crates/history/Cargo.toml index 2435690a..a4bcf9ac 100644 --- a/crates/history/Cargo.toml +++ b/crates/history/Cargo.toml @@ -14,7 +14,7 @@ categories = ["api-bindings", "history", "wasm"] wasm-bindgen = "0.2" gloo-utils = { version = "0.1.7", path = "../utils" } gloo-events = { version = "0.1.0", path = "../events" } -serde = "1" +serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.5.0" serde_urlencoded = { version = "0.7", optional = true } thiserror = { version = "1.0", optional = true } @@ -30,7 +30,6 @@ features = [ [dev-dependencies] wasm-bindgen-test = "0.3" -serde = { version = "1", features = ["derive"] } gloo-timers = { version = "0.2.6", features = ["futures"], path = "../timers" } [features] From b0dd90cd5626f6d209ce460f6d21fdef30b4f693 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 23 Jul 2023 12:02:26 +0200 Subject: [PATCH 2/2] history: Simplify cfg expressions Guided by clippy. --- crates/history/src/any.rs | 4 ++-- crates/history/src/browser.rs | 4 ++-- crates/history/src/hash.rs | 4 ++-- crates/history/src/history.rs | 4 ++-- crates/history/src/memory.rs | 4 ++-- crates/history/tests/browser_history_feat_serialize.rs | 4 ++-- crates/history/tests/hash_history_feat_serialize.rs | 4 ++-- crates/history/tests/memory_history_feat_serialize.rs | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/history/src/any.rs b/crates/history/src/any.rs index 33dff1d5..822f91e5 100644 --- a/crates/history/src/any.rs +++ b/crates/history/src/any.rs @@ -105,7 +105,7 @@ impl History for AnyHistory { } } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn push_with_query_and_state<'a, Q, T>( &self, route: impl Into>, @@ -123,7 +123,7 @@ impl History for AnyHistory { } } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn replace_with_query_and_state<'a, Q, T>( &self, route: impl Into>, diff --git a/crates/history/src/browser.rs b/crates/history/src/browser.rs index 01f28493..3ff9ad95 100644 --- a/crates/history/src/browser.rs +++ b/crates/history/src/browser.rs @@ -148,7 +148,7 @@ impl History for BrowserHistory { Ok(()) } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn push_with_query_and_state<'a, Q, T>( &self, route: impl Into>, @@ -178,7 +178,7 @@ impl History for BrowserHistory { Ok(()) } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn replace_with_query_and_state<'a, Q, T>( &self, route: impl Into>, diff --git a/crates/history/src/hash.rs b/crates/history/src/hash.rs index 7f052bb9..774d72dd 100644 --- a/crates/history/src/hash.rs +++ b/crates/history/src/hash.rs @@ -134,7 +134,7 @@ impl History for HashHistory { Ok(()) } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn push_with_query_and_state<'a, Q, T>( &self, route: impl Into>, @@ -160,7 +160,7 @@ impl History for HashHistory { Ok(()) } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn replace_with_query_and_state<'a, Q, T>( &self, route: impl Into>, diff --git a/crates/history/src/history.rs b/crates/history/src/history.rs index 9f97e65f..52ee1804 100644 --- a/crates/history/src/history.rs +++ b/crates/history/src/history.rs @@ -71,7 +71,7 @@ pub trait History: Clone + PartialEq { Q: Serialize; /// Same as `.push_with_state()` but affix the queries to the end of the route. - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn push_with_query_and_state<'a, Q, T>( &self, route: impl Into>, @@ -83,7 +83,7 @@ pub trait History: Clone + PartialEq { T: 'static; /// Same as `.replace_with_state()` but affix the queries to the end of the route. - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn replace_with_query_and_state<'a, Q, T>( &self, route: impl Into>, diff --git a/crates/history/src/memory.rs b/crates/history/src/memory.rs index 260872a7..cc19b442 100644 --- a/crates/history/src/memory.rs +++ b/crates/history/src/memory.rs @@ -266,7 +266,7 @@ impl History for MemoryHistory { Ok(()) } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn push_with_query_and_state<'a, Q, T>( &self, route: impl Into>, @@ -299,7 +299,7 @@ impl History for MemoryHistory { Ok(()) } - #[cfg(all(feature = "query"))] + #[cfg(feature = "query")] fn replace_with_query_and_state<'a, Q, T>( &self, route: impl Into>, diff --git a/crates/history/tests/browser_history_feat_serialize.rs b/crates/history/tests/browser_history_feat_serialize.rs index f5ead2e3..05cd5373 100644 --- a/crates/history/tests/browser_history_feat_serialize.rs +++ b/crates/history/tests/browser_history_feat_serialize.rs @@ -2,10 +2,10 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; wasm_bindgen_test_configure!(run_in_browser); -#[cfg(all(feature = "query"))] +#[cfg(feature = "query")] mod utils; -#[cfg(all(feature = "query"))] +#[cfg(feature = "query")] mod feat_serialize { use super::*; diff --git a/crates/history/tests/hash_history_feat_serialize.rs b/crates/history/tests/hash_history_feat_serialize.rs index c76d1ff9..4b005c9e 100644 --- a/crates/history/tests/hash_history_feat_serialize.rs +++ b/crates/history/tests/hash_history_feat_serialize.rs @@ -2,10 +2,10 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; wasm_bindgen_test_configure!(run_in_browser); -#[cfg(all(feature = "query"))] +#[cfg(feature = "query")] mod utils; -#[cfg(all(feature = "query"))] +#[cfg(feature = "query")] mod feat_serialize { use super::*; diff --git a/crates/history/tests/memory_history_feat_serialize.rs b/crates/history/tests/memory_history_feat_serialize.rs index 0683b25c..ab258533 100644 --- a/crates/history/tests/memory_history_feat_serialize.rs +++ b/crates/history/tests/memory_history_feat_serialize.rs @@ -2,7 +2,7 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; wasm_bindgen_test_configure!(run_in_browser); -#[cfg(all(feature = "query"))] +#[cfg(feature = "query")] mod feat_serialize { use wasm_bindgen_test::wasm_bindgen_test as test;