diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08d2a76b..1a3cbcb3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,9 @@ repos: rev: v1.0 hooks: - id: fmt + - id: cargo-check + name: cargo-check-no-features + alias: cargo-check-no-features - id: cargo-check name: cargo-check-csr alias: cargo-check-csr @@ -40,6 +43,10 @@ repos: name: cargo-check-hydrate alias: cargo-check-hydrate args: [--features=hydrate] + - id: clippy + alias: clippy-no-features + name: clippy-no-features + args: [--, -A, clippy::comparison-chain, -Dwarnings] - id: clippy alias: clippy-csr name: clippy-csr diff --git a/Cargo.lock b/Cargo.lock index 53e8c338..846dd4c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1333,7 +1333,7 @@ dependencies = [ "cfg-if", "fluent-templates", "leptos", - "leptos-fluent-macros", + "leptos-fluent-macros 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", "leptos_router", "once_cell", "web-sys", @@ -1362,6 +1362,20 @@ dependencies = [ "web-sys", ] +[[package]] +name = "leptos-fluent-macros" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13d1a4cffa3de5c8535bc2905e9ca74708dc21afc4b4b3762de39833dd69421" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.48", + "web-sys", +] + [[package]] name = "leptos-fluent-minimal-example" version = "0.1.0" diff --git a/leptos-fluent/Cargo.toml b/leptos-fluent/Cargo.toml index 30ad9875..73b45e69 100644 --- a/leptos-fluent/Cargo.toml +++ b/leptos-fluent/Cargo.toml @@ -8,7 +8,7 @@ documentation = "https://docs.rs/leptos-fluent" repository = "https://github.com/mondeja/leptos-fluent" [dependencies] -leptos-fluent-macros = { path = "../leptos-fluent-macros" } +leptos-fluent-macros = "0.0.19" fluent-templates = "0.9" leptos = ">=0.1" leptos_router = { version = ">=0.1", optional = true } diff --git a/leptos-fluent/src/localstorage.rs b/leptos-fluent/src/localstorage.rs index 2045f0ec..c89c404d 100644 --- a/leptos-fluent/src/localstorage.rs +++ b/leptos-fluent/src/localstorage.rs @@ -1,9 +1,7 @@ use cfg_if::cfg_if; -pub fn get( - #[cfg_attr(feature = "ssr", allow(unused_variables))] key: &str, -) -> Option { - cfg_if! { if #[cfg(not(feature = "ssr"))] { +pub fn get(#[allow(unused_variables)] key: &str) -> Option { + cfg_if! { if #[cfg(all(not(feature = "ssr"), feature = "csr", feature = "hydrate"))] { ::leptos::window() .local_storage() .unwrap() @@ -16,8 +14,8 @@ pub fn get( } pub fn set( - #[cfg_attr(feature = "ssr", allow(unused_variables))] key: &str, - #[cfg_attr(feature = "ssr", allow(unused_variables))] value: &str, + #[allow(unused_variables)] key: &str, + #[allow(unused_variables)] value: &str, ) { cfg_if! { if #[cfg(any(feature = "csr", feature = "hydrate"))] { ::leptos::window() diff --git a/leptos-fluent/src/url.rs b/leptos-fluent/src/url.rs index 7265651f..97cc5a9b 100644 --- a/leptos-fluent/src/url.rs +++ b/leptos-fluent/src/url.rs @@ -1,9 +1,7 @@ use cfg_if::cfg_if; -pub fn get( - #[cfg_attr(feature = "ssr", allow(unused_variables))] k: &str, -) -> Option { - cfg_if! { if #[cfg(not(feature = "ssr"))] { +pub fn get(#[allow(unused_variables)] k: &str) -> Option { + cfg_if! { if #[cfg(all(not(feature = "ssr"), feature = "csr", feature = "hydrate"))] { use leptos_router::Url; let query = ::leptos::window().location().search().unwrap();