From 6001a93142f49011e378a2b64caf5b3f4fc818da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Sat, 27 Jul 2024 18:35:59 +0200 Subject: [PATCH] Run `cargo clippy` --- src/core/element_maybe_signal.rs | 2 ++ src/core/elements_maybe_signal.rs | 2 ++ src/on_click_outside.rs | 6 +++--- src/storage/use_storage.rs | 2 +- src/use_broadcast_channel.rs | 2 +- src/use_color_mode.rs | 2 +- src/use_cookie.rs | 2 +- src/use_event_source.rs | 2 +- src/use_websocket.rs | 3 ++- src/watch_with_options.rs | 2 -- 10 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/core/element_maybe_signal.rs b/src/core/element_maybe_signal.rs index 6d25d41..6b81824 100644 --- a/src/core/element_maybe_signal.rs +++ b/src/core/element_maybe_signal.rs @@ -6,11 +6,13 @@ use std::marker::PhantomData; use std::ops::Deref; /// Used as an argument type to make it easily possible to pass either +/// /// * a `web_sys` element that implements `E` (for example `EventTarget`, `Element` or `HtmlElement`), /// * an `Option` where `T` is the web_sys element, /// * a `Signal` where `T` is the web_sys element, /// * a `Signal>` where `T` is the web_sys element, /// * a `NodeRef` +/// /// into a function. Used for example in [`fn@crate::use_event_listener`]. pub enum ElementMaybeSignal where diff --git a/src/core/elements_maybe_signal.rs b/src/core/elements_maybe_signal.rs index c8446d9..cbc761a 100644 --- a/src/core/elements_maybe_signal.rs +++ b/src/core/elements_maybe_signal.rs @@ -7,11 +7,13 @@ use std::marker::PhantomData; use std::ops::Deref; /// Used as an argument type to make it easily possible to pass either +/// /// * a `web_sys` element that implements `E` (for example `EventTarget` or `Element`), /// * an `Option` where `T` is the web_sys element, /// * a `Signal` where `T` is the web_sys element, /// * a `Signal>` where `T` is the web_sys element, /// * a `NodeRef` +/// /// into a function. Used for example in [`fn@crate::use_event_listener`]. pub enum ElementsMaybeSignal where diff --git a/src/on_click_outside.rs b/src/on_click_outside.rs index def8aa8..403a005 100644 --- a/src/on_click_outside.rs +++ b/src/on_click_outside.rs @@ -45,9 +45,9 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] { /// ``` /// /// > This function uses [Event.composedPath()](https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath) -/// which is **not** supported by IE 11, Edge 18 and below. -/// If you are targeting these browsers, we recommend you to include -/// [this code snippet](https://gist.github.com/sibbng/13e83b1dd1b733317ce0130ef07d4efd) on your project. +/// > which is **not** supported by IE 11, Edge 18 and below. +/// > If you are targeting these browsers, we recommend you to include +/// > [this code snippet](https://gist.github.com/sibbng/13e83b1dd1b733317ce0130ef07d4efd) on your project. /// /// ## Excluding Elements /// diff --git a/src/storage/use_storage.rs b/src/storage/use_storage.rs index 4f9c2af..0d8f903 100644 --- a/src/storage/use_storage.rs +++ b/src/storage/use_storage.rs @@ -31,7 +31,7 @@ const INTERNAL_STORAGE_EVENT: &str = "leptos-use-storage"; /// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are -/// available and what feature flags they require. +/// > available and what feature flags they require. /// /// ## Example /// diff --git a/src/use_broadcast_channel.rs b/src/use_broadcast_channel.rs index 37cc0c5..6355356 100644 --- a/src/use_broadcast_channel.rs +++ b/src/use_broadcast_channel.rs @@ -48,7 +48,7 @@ use wasm_bindgen::JsValue; /// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are -/// available and what feature flags they require. +/// > available and what feature flags they require. /// /// ``` /// # use leptos::*; diff --git a/src/use_color_mode.rs b/src/use_color_mode.rs index 66cdd39..1df636b 100644 --- a/src/use_color_mode.rs +++ b/src/use_color_mode.rs @@ -426,7 +426,7 @@ where /// To get the default behaviour back you can call the provided `default_handler` function. /// It takes two parameters: /// - `mode: ColorMode`: The color mode to change to. - /// -`default_handler: Rc`: The default handler that would have been called if the `on_changed` handler had not been specified. + /// - `default_handler: Rc`: The default handler that would have been called if the `on_changed` handler had not been specified. on_changed: OnChangedFn, /// When provided, `useStorage` will be skipped. diff --git a/src/use_cookie.rs b/src/use_cookie.rs index aabfe2d..1af6615 100644 --- a/src/use_cookie.rs +++ b/src/use_cookie.rs @@ -60,7 +60,7 @@ use std::rc::Rc; /// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are -/// available and what feature flags they require. +/// > available and what feature flags they require. /// /// ## Cookie attributes /// diff --git a/src/use_event_source.rs b/src/use_event_source.rs index c3fd25d..30edbfb 100644 --- a/src/use_event_source.rs +++ b/src/use_event_source.rs @@ -22,7 +22,7 @@ use thiserror::Error; /// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are -/// available and what feature flags they require. +/// > available and what feature flags they require. /// /// /// ``` diff --git a/src/use_websocket.rs b/src/use_websocket.rs index 8654832..48a9596 100644 --- a/src/use_websocket.rs +++ b/src/use_websocket.rs @@ -28,7 +28,7 @@ use web_sys::{BinaryType, CloseEvent, Event, MessageEvent, WebSocket}; /// Values are (en)decoded via the given codec. You can use any of the codecs, string or binary. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are -/// available and what feature flags they require. +/// > available and what feature flags they require. /// /// ``` /// # use leptos::*; @@ -248,6 +248,7 @@ where } /// Version of [`use_websocket`] that takes `UseWebSocketOptions`. See [`use_websocket`] for how to use. +#[allow(clippy::type_complexity)] pub fn use_websocket_with_options( url: &str, options: UseWebSocketOptions< diff --git a/src/watch_with_options.rs b/src/watch_with_options.rs index 85747fd..4e0f4ad 100644 --- a/src/watch_with_options.rs +++ b/src/watch_with_options.rs @@ -89,8 +89,6 @@ use std::rc::Rc; /// /// * [`fn@crate::watch_throttled`] /// * [`fn@crate::watch_debounced`] - -/// Version of `watch` that accepts `WatchOptions`. See [`watch`] for how to use. pub fn watch_with_options( deps: DFn, callback: CFn,