chore: clippy

This commit is contained in:
Greg Johnston 2024-07-12 11:53:29 -04:00
parent 04c67cb8b6
commit 62cb361031
14 changed files with 27 additions and 21 deletions

View file

@ -17,7 +17,7 @@ axum = { version = "0.7", default-features = false, features = [
futures = "0.3"
http = "1"
http-body-util = "0.1"
leptos = { workspace = true, features = ["nonce", "hydration"] }
leptos = { workspace = true, features = ["nonce", "ssr"] }
server_fn = { workspace = true, features = ["axum-no-default"] }
leptos_macro = { workspace = true, features = ["axum"] }
leptos_meta = { workspace = true, features = ["ssr"] }

View file

@ -1771,7 +1771,7 @@ async fn get_static_file(
.unwrap();
// `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot`
// This path is relative to the cargo root
match ServeDir::new(&*root).oneshot(req).await {
match ServeDir::new(root).oneshot(req).await {
Ok(res) => Ok(res.into_response()),
Err(err) => Err((
StatusCode::INTERNAL_SERVER_ERROR,

View file

@ -351,7 +351,7 @@ pub fn get_configuration(
path: Option<&str>,
) -> Result<ConfFile, LeptosConfigError> {
if let Some(path) = path {
get_config_from_file(&path)
get_config_from_file(path)
} else {
get_config_from_env()
}

View file

@ -105,7 +105,7 @@ where
value.with_untracked(|data| match &data {
// TODO handle serialization errors
Some(val) => {
Ser::encode(&val).unwrap().into_encoded_string()
Ser::encode(val).unwrap().into_encoded_string()
}
_ => unreachable!(),
})

View file

@ -186,7 +186,7 @@ where
}
}
};
value.unwrap_or_else(|| initial())
value.unwrap_or_else(initial)
} else {
let init = initial();
#[cfg(feature = "ssr")]

View file

@ -436,6 +436,7 @@ where
Inner: Deref,
{
inner: Inner,
#[allow(clippy::type_complexity)]
map_fn: Arc<dyn Fn(&Inner::Target) -> &U>,
}
@ -511,7 +512,9 @@ where
Inner: Deref,
{
inner: Inner,
#[allow(clippy::type_complexity)]
map_fn: Arc<dyn Fn(&Inner::Target) -> &U>,
#[allow(clippy::type_complexity)]
map_fn_mut: Arc<dyn Fn(&mut Inner::Target) -> &mut U>,
}

View file

@ -13,7 +13,7 @@ use crate::{
resolve_path::resolve_path,
ChooseView, MatchNestedRoutes, NestedRoute, Routes, SsrMode,
};
use either_of::EitherOf3;
use either_of::Either;
use leptos::prelude::*;
use reactive_graph::{
owner::{provide_context, use_context, Owner},
@ -332,11 +332,13 @@ where
<Transition>
{move || {
match condition() {
Some(true) => EitherOf3::A(view()),
Some(false) => EitherOf3::B(view! { <Redirect path=redirect_path()/> }),
None => EitherOf3::C(())
Some(true) => Either::Left(view()),
#[allow(clippy::unit_arg)]
Some(false) => Either::Right(view! { <Redirect path=redirect_path()/> }),
None => Either::Right(()),
}
}}
</Transition>
})
.into_any()
@ -375,11 +377,13 @@ where
<Transition>
{move || {
match condition() {
Some(true) => EitherOf3::A(view()),
Some(false) => EitherOf3::B(view! { <Redirect path=redirect_path()/> }),
None => EitherOf3::C(())
Some(true) => Either::Left(view()),
#[allow(clippy::unit_arg)]
Some(false) => Either::Right(view! { <Redirect path=redirect_path()/> }),
None => Either::Right(()),
}
}}
</Transition>
})
.into_any()
@ -517,7 +521,7 @@ pub fn RoutingProgress(
view! {
<Show when=move || is_showing.get() fallback=|| ()>
<progress min="0" max="100" value=move || progress.get()/>
<progress min="0" max="100" value=move || progress.get()></progress>
</Show>
}
}

View file

@ -309,7 +309,7 @@ where
let has_router = has_router();
let action = if has_router {
use_resolved_path::<Dom>(move || action.to_href()())
use_resolved_path(move || action.to_href()())
} else {
ArcMemo::new(move |_| Some(action.to_href()()))
};

View file

@ -13,7 +13,6 @@ use reactive_graph::{
wrappers::write::SignalSetter,
};
use std::str::FromStr;
use tachys::renderer::Renderer;
#[track_caller]
#[deprecated = "This has been renamed to `query_signal` to match Rust naming \
@ -219,7 +218,7 @@ pub(crate) struct Matched(pub ArcRwSignal<String>);
/// Resolves the given path relative to the current route.
#[track_caller]
pub(crate) fn use_resolved_path<R: Renderer + 'static>(
pub(crate) fn use_resolved_path(
path: impl Fn() -> String + Send + Sync + 'static,
) -> ArcMemo<Option<String>> {
let router = use_context::<RouterContext>()

View file

@ -130,6 +130,6 @@ where
}
}
let href = use_resolved_path::<Dom>(move || href.to_href()());
let href = use_resolved_path(move || href.to_href()());
inner(href, target, exact, state, replace, children)
}

View file

@ -253,7 +253,7 @@ where
})),
Some(children) => {
Either::Right(children.generate_routes().into_iter().map(move |child| {
let segments = segment_routes.clone().into_iter().chain(child.segments.into_iter()).collect();
let segments = segment_routes.clone().into_iter().chain(child.segments).collect();
if child.ssr_mode > ssr_mode {
GeneratedRouteData {
segments,

View file

@ -747,7 +747,7 @@ where
fn rebuild(self, state: &mut Self::State) {
Executor::spawn_local({
let state = Rc::clone(&state);
let state = Rc::clone(state);
async move {
let value = self.0.await;
let mut state = state.borrow_mut();

View file

@ -398,7 +398,7 @@ where
fn rebuild(self, key: &str, state: &mut Self::State) {
let key = key.to_owned();
Executor::spawn_local({
let state = Rc::clone(&state);
let state = Rc::clone(state);
async move {
let value = self.0.await;
let mut state = state.borrow_mut();

View file

@ -475,7 +475,7 @@ where
fn rebuild(self, state: &mut Self::State) {
Executor::spawn_local({
let state = Rc::clone(&state);
let state = Rc::clone(state);
async move {
let value = self.0.await;
let mut state = state.borrow_mut();