Skip to content

Commit

Permalink
Fix error in feature gates
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Mar 10, 2024
1 parent 2e95103 commit d43a24f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 15 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion leptos-fluent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
10 changes: 4 additions & 6 deletions leptos-fluent/src/localstorage.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use cfg_if::cfg_if;

pub fn get(
#[cfg_attr(feature = "ssr", allow(unused_variables))] key: &str,
) -> Option<String> {
cfg_if! { if #[cfg(not(feature = "ssr"))] {
pub fn get(#[allow(unused_variables)] key: &str) -> Option<String> {
cfg_if! { if #[cfg(all(not(feature = "ssr"), feature = "csr", feature = "hydrate"))] {
::leptos::window()
.local_storage()
.unwrap()
Expand All @@ -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()
Expand Down
6 changes: 2 additions & 4 deletions leptos-fluent/src/url.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use cfg_if::cfg_if;

pub fn get(
#[cfg_attr(feature = "ssr", allow(unused_variables))] k: &str,
) -> Option<String> {
cfg_if! { if #[cfg(not(feature = "ssr"))] {
pub fn get(#[allow(unused_variables)] k: &str) -> Option<String> {
cfg_if! { if #[cfg(all(not(feature = "ssr"), feature = "csr", feature = "hydrate"))] {
use leptos_router::Url;

let query = ::leptos::window().location().search().unwrap();
Expand Down

0 comments on commit d43a24f

Please # to comment.