From 53b22a9b74590e1d20f93d56105a92c70c4e0062 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Sat, 27 Apr 2024 11:52:38 -0400 Subject: [PATCH] clear some warnings --- integrations/axum/src/lib.rs | 90 ++++++++++++++------------- tachys/src/html/attribute/custom.rs | 2 +- tachys/src/html/attribute/global.rs | 2 +- tachys/src/html/attribute/value.rs | 1 - tachys/src/html/element/custom.rs | 2 +- tachys/src/html/element/inner_html.rs | 2 +- tachys/src/html/element/mod.rs | 7 +-- tachys/src/html/mod.rs | 5 +- tachys/src/oco.rs | 1 - tachys/src/reactive_graph/guards.rs | 1 - tachys/src/reactive_graph/mod.rs | 15 +---- tachys/src/reactive_graph/style.rs | 2 - tachys/src/renderer/sledgehammer.rs | 5 +- tachys/src/view/any_view.rs | 1 - tachys/src/view/either.rs | 12 +--- tachys/src/view/error_boundary.rs | 8 --- tachys/src/view/iterators.rs | 13 +--- tachys/src/view/keyed.rs | 1 - tachys/src/view/primitives.rs | 1 - tachys/src/view/static_types.rs | 5 +- tachys/src/view/strings.rs | 7 +-- tachys/src/view/tuples.rs | 6 -- 22 files changed, 61 insertions(+), 128 deletions(-) diff --git a/integrations/axum/src/lib.rs b/integrations/axum/src/lib.rs index 215ae690e..54b860a51 100644 --- a/integrations/axum/src/lib.rs +++ b/integrations/axum/src/lib.rs @@ -57,13 +57,13 @@ use leptos::{ IntoView, }; use leptos_meta::{MetaContext, ServerMetaContext}; -use once_cell::sync::OnceCell; -use parking_lot::RwLock; -use reactive_graph::owner::Sandboxed; -use routing::{ +use leptos_router::{ location::RequestUrl, PathSegment, RouteList, RouteListing, SsrMode, StaticDataMap, StaticMode, }; +use once_cell::sync::OnceCell; +use parking_lot::RwLock; +use reactive_graph::owner::Sandboxed; use server_fn::{ error::{NoCustomError, ServerFnErrorSerde}, @@ -1149,7 +1149,7 @@ where pub struct AxumRouteListing { path: String, mode: SsrMode, - methods: Vec, + methods: Vec, static_mode: Option<(StaticMode, StaticDataMap)>, } @@ -1178,7 +1178,7 @@ impl AxumRouteListing { pub fn new( path: String, mode: SsrMode, - methods: impl IntoIterator, + methods: impl IntoIterator, static_mode: Option<(StaticMode, StaticDataMap)>, ) -> Self { Self { @@ -1200,7 +1200,7 @@ impl AxumRouteListing { } /// The HTTP request methods this path can handle. - pub fn methods(&self) -> impl Iterator + '_ { + pub fn methods(&self) -> impl Iterator + '_ { self.methods.iter().copied() } @@ -1249,7 +1249,7 @@ where vec![AxumRouteListing::new( "/".to_string(), Default::default(), - [routing::Method::Get], + [leptos_router::Method::Get], None, )] } else { @@ -1405,7 +1405,7 @@ fn static_route( options: LeptosOptions, app_fn: impl Fn() -> IV + Clone + Send + 'static, additional_context: impl Fn() + Clone + Send + 'static, - method: routing::Method, + method: leptos_router::Method, mode: StaticMode, ) -> axum::Router where @@ -1449,11 +1449,11 @@ where router.route( path, match method { - routing::Method::Get => get(handler), - routing::Method::Post => post(handler), - routing::Method::Put => put(handler), - routing::Method::Delete => delete(handler), - routing::Method::Patch => patch(handler), + leptos_router::Method::Get => get(handler), + leptos_router::Method::Post => post(handler), + leptos_router::Method::Put => put(handler), + leptos_router::Method::Delete => delete(handler), + leptos_router::Method::Patch => patch(handler), }, ) } @@ -1492,11 +1492,11 @@ where router.route( path, match method { - routing::Method::Get => get(handler), - routing::Method::Post => post(handler), - routing::Method::Put => put(handler), - routing::Method::Delete => delete(handler), - routing::Method::Patch => patch(handler), + leptos_router::Method::Get => get(handler), + leptos_router::Method::Post => post(handler), + leptos_router::Method::Put => put(handler), + leptos_router::Method::Delete => delete(handler), + leptos_router::Method::Patch => patch(handler), }, ) } @@ -1645,11 +1645,11 @@ where app_fn.clone(), ); match method { - routing::Method::Get => get(s), - routing::Method::Post => post(s), - routing::Method::Put => put(s), - routing::Method::Delete => delete(s), - routing::Method::Patch => patch(s), + leptos_router::Method::Get => get(s), + leptos_router::Method::Post => post(s), + leptos_router::Method::Put => put(s), + leptos_router::Method::Delete => delete(s), + leptos_router::Method::Patch => patch(s), } } SsrMode::PartiallyBlocked => { @@ -1660,11 +1660,11 @@ where true ); match method { - routing::Method::Get => get(s), - routing::Method::Post => post(s), - routing::Method::Put => put(s), - routing::Method::Delete => delete(s), - routing::Method::Patch => patch(s), + leptos_router::Method::Get => get(s), + leptos_router::Method::Post => post(s), + leptos_router::Method::Put => put(s), + leptos_router::Method::Delete => delete(s), + leptos_router::Method::Patch => patch(s), } } SsrMode::InOrder => { @@ -1674,11 +1674,11 @@ where app_fn.clone(), ); match method { - routing::Method::Get => get(s), - routing::Method::Post => post(s), - routing::Method::Put => put(s), - routing::Method::Delete => delete(s), - routing::Method::Patch => patch(s), + leptos_router::Method::Get => get(s), + leptos_router::Method::Post => post(s), + leptos_router::Method::Put => put(s), + leptos_router::Method::Delete => delete(s), + leptos_router::Method::Patch => patch(s), } } SsrMode::Async => { @@ -1688,11 +1688,11 @@ where app_fn.clone(), ); match method { - routing::Method::Get => get(s), - routing::Method::Post => post(s), - routing::Method::Put => put(s), - routing::Method::Delete => delete(s), - routing::Method::Patch => patch(s), + leptos_router::Method::Get => get(s), + leptos_router::Method::Post => post(s), + leptos_router::Method::Put => put(s), + leptos_router::Method::Delete => delete(s), + leptos_router::Method::Patch => patch(s), } } }, @@ -1720,11 +1720,13 @@ where router = router.route( listing.path(), match method { - routing::Method::Get => get(handler.clone()), - routing::Method::Post => post(handler.clone()), - routing::Method::Put => put(handler.clone()), - routing::Method::Delete => delete(handler.clone()), - routing::Method::Patch => patch(handler.clone()), + leptos_router::Method::Get => get(handler.clone()), + leptos_router::Method::Post => post(handler.clone()), + leptos_router::Method::Put => put(handler.clone()), + leptos_router::Method::Delete => { + delete(handler.clone()) + } + leptos_router::Method::Patch => patch(handler.clone()), }, ); } diff --git a/tachys/src/html/attribute/custom.rs b/tachys/src/html/attribute/custom.rs index fd3fb9bbb..01da70e89 100644 --- a/tachys/src/html/attribute/custom.rs +++ b/tachys/src/html/attribute/custom.rs @@ -4,7 +4,7 @@ use crate::{ renderer::DomRenderer, view::{add_attr::AddAnyAttr, Position, ToTemplate}, }; -use std::{borrow::Cow, marker::PhantomData, rc::Rc, sync::Arc}; +use std::{borrow::Cow, marker::PhantomData, sync::Arc}; #[inline(always)] pub fn custom_attribute(key: K, value: V) -> CustomAttr diff --git a/tachys/src/html/attribute/global.rs b/tachys/src/html/attribute/global.rs index 08db0265f..e5eb6025f 100644 --- a/tachys/src/html/attribute/global.rs +++ b/tachys/src/html/attribute/global.rs @@ -3,7 +3,7 @@ use crate::{ html::{ attribute::*, class::{class, Class, IntoClass}, - element::{ElementType, HasElementType}, + element::HasElementType, event::{on, on_target, EventDescriptor, On, Targeted}, property::{property, IntoProperty, Property}, style::{style, IntoStyle, Style}, diff --git a/tachys/src/html/attribute/value.rs b/tachys/src/html/attribute/value.rs index af91aabae..109398abe 100644 --- a/tachys/src/html/attribute/value.rs +++ b/tachys/src/html/attribute/value.rs @@ -1,7 +1,6 @@ use crate::renderer::Renderer; use std::{ borrow::Cow, - fmt::Write, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}, num::{ NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, diff --git a/tachys/src/html/element/custom.rs b/tachys/src/html/element/custom.rs index 739a60818..d0d63ccba 100644 --- a/tachys/src/html/element/custom.rs +++ b/tachys/src/html/element/custom.rs @@ -3,7 +3,7 @@ use crate::{ html::element::{CreateElement, ElementType, HtmlElement}, renderer::{dom::Dom, Renderer}, }; -use std::{borrow::Cow, fmt::Debug, marker::PhantomData, rc::Rc, sync::Arc}; +use std::{borrow::Cow, fmt::Debug, marker::PhantomData, sync::Arc}; // FIXME custom element HTML rendering is broken because tag names aren't static pub fn custom(tag: E) -> HtmlElement, (), (), Rndr> diff --git a/tachys/src/html/element/inner_html.rs b/tachys/src/html/element/inner_html.rs index 17a2f7959..6f17dfefb 100644 --- a/tachys/src/html/element/inner_html.rs +++ b/tachys/src/html/element/inner_html.rs @@ -4,7 +4,7 @@ use crate::{ renderer::{DomRenderer, Renderer}, view::add_attr::AddAnyAttr, }; -use std::{marker::PhantomData, rc::Rc, sync::Arc}; +use std::{marker::PhantomData, sync::Arc}; #[inline(always)] pub fn inner_html(value: T) -> InnerHtml diff --git a/tachys/src/html/element/mod.rs b/tachys/src/html/element/mod.rs index e1bf87f68..23c9cfb42 100644 --- a/tachys/src/html/element/mod.rs +++ b/tachys/src/html/element/mod.rs @@ -12,12 +12,7 @@ use const_str_slice_concat::{ const_concat, const_concat_with_prefix, str_from_buffer, }; use next_tuple::NextTuple; -use std::{ - future::Future, - marker::PhantomData, - pin::Pin, - task::{Context, Poll}, -}; +use std::marker::PhantomData; mod custom; mod elements; diff --git a/tachys/src/html/mod.rs b/tachys/src/html/mod.rs index 722e47ae2..d617a9700 100644 --- a/tachys/src/html/mod.rs +++ b/tachys/src/html/mod.rs @@ -2,10 +2,7 @@ use crate::{ renderer::Renderer, view::{Position, Render, RenderHtml}, }; -use std::{ - future::{ready, Ready}, - marker::PhantomData, -}; +use std::marker::PhantomData; pub mod attribute; pub mod class; diff --git a/tachys/src/oco.rs b/tachys/src/oco.rs index 510f1b0eb..cce160f57 100644 --- a/tachys/src/oco.rs +++ b/tachys/src/oco.rs @@ -6,7 +6,6 @@ use crate::{ view::{strings::StrState, Position, PositionState, ToTemplate}, }; use oco_ref::Oco; -use std::future::{ready, Ready}; pub struct OcoStrState { node: R::Text, diff --git a/tachys/src/reactive_graph/guards.rs b/tachys/src/reactive_graph/guards.rs index d4afdbc80..c350bb790 100644 --- a/tachys/src/reactive_graph/guards.rs +++ b/tachys/src/reactive_graph/guards.rs @@ -12,7 +12,6 @@ use crate::{ use reactive_graph::signal::guards::ReadGuard; use std::{ fmt::Write, - future::{ready, Ready}, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}, num::{ NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, diff --git a/tachys/src/reactive_graph/mod.rs b/tachys/src/reactive_graph/mod.rs index 57f2a0f52..90f658fcd 100644 --- a/tachys/src/reactive_graph/mod.rs +++ b/tachys/src/reactive_graph/mod.rs @@ -1,5 +1,4 @@ use crate::{ - async_views::Suspend, html::attribute::{Attribute, AttributeValue}, hydration::Cursor, renderer::Renderer, @@ -9,13 +8,7 @@ use crate::{ RenderHtml, ToTemplate, }, }; -use reactive_graph::{ - computed::ScopedFuture, - effect::RenderEffect, - graph::{Observer, ReactiveNode}, -}; -use std::future::{ready, Ready}; -use throw_error::Error as AnyError; +use reactive_graph::effect::RenderEffect; mod class; mod guards; @@ -371,7 +364,7 @@ where mod stable { use super::RenderEffectState; use crate::{ - html::attribute::{Attribute, AttributeValue}, + html::attribute::AttributeValue, hydration::Cursor, renderer::Renderer, ssr::StreamBuilder, @@ -383,8 +376,6 @@ mod stable { traits::Get, wrappers::read::{ArcSignal, Signal}, }; - use std::future::{ready, Ready}; - use throw_error::Error as AnyError; macro_rules! signal_impl { ($sig:ident) => { @@ -477,7 +468,7 @@ mod stable { fn to_template(_key: &str, _buf: &mut String) {} fn hydrate( - mut self, + self, key: &str, el: &::Element, ) -> Self::State { diff --git a/tachys/src/reactive_graph/style.rs b/tachys/src/reactive_graph/style.rs index 523c90880..c42a5849b 100644 --- a/tachys/src/reactive_graph/style.rs +++ b/tachys/src/reactive_graph/style.rs @@ -45,7 +45,6 @@ where (style.clone(), value) } }) - .into() } fn build(self, el: &R::Element) -> Self::State { @@ -70,7 +69,6 @@ where (style.clone(), value) } }) - .into() } fn rebuild(self, _state: &mut Self::State) { diff --git a/tachys/src/renderer/sledgehammer.rs b/tachys/src/renderer/sledgehammer.rs index 651e400b3..bbd562dd7 100644 --- a/tachys/src/renderer/sledgehammer.rs +++ b/tachys/src/renderer/sledgehammer.rs @@ -1,11 +1,9 @@ use super::{CastFrom, DomRenderer, Renderer}; use crate::{ - dom::{document, window}, - ok_or_debug, or_debug, + dom::window, view::{Mountable, ToTemplate}, }; use linear_map::LinearMap; -use once_cell::sync::Lazy; use rustc_hash::FxHashSet; use sledgehammer_bindgen::bindgen; use std::{ @@ -15,7 +13,6 @@ use std::{ rc::Rc, }; use wasm_bindgen::{ - intern, prelude::{wasm_bindgen, Closure}, JsCast, JsValue, }; diff --git a/tachys/src/view/any_view.rs b/tachys/src/view/any_view.rs index 2d033649a..6035aa63d 100644 --- a/tachys/src/view/any_view.rs +++ b/tachys/src/view/any_view.rs @@ -3,7 +3,6 @@ use crate::{hydration::Cursor, renderer::Renderer, ssr::StreamBuilder}; use std::{ any::{Any, TypeId}, fmt::Debug, - future::Ready, marker::PhantomData, }; diff --git a/tachys/src/view/either.rs b/tachys/src/view/either.rs index 985057604..d3f9936d0 100644 --- a/tachys/src/view/either.rs +++ b/tachys/src/view/either.rs @@ -1,14 +1,6 @@ use super::{Mountable, Position, PositionState, Render, RenderHtml}; -use crate::{ - hydration::Cursor, - renderer::{CastFrom, Renderer}, - ssr::StreamBuilder, -}; +use crate::{hydration::Cursor, renderer::Renderer, ssr::StreamBuilder}; use either_of::*; -use std::{ - error::Error, - fmt::{Debug, Display}, -}; pub struct EitherState where @@ -283,7 +275,7 @@ where todo!() } - fn to_html_with_buf(self, buf: &mut String, position: &mut Position) { + fn to_html_with_buf(self, _buf: &mut String, _position: &mut Position) { todo!() } diff --git a/tachys/src/view/error_boundary.rs b/tachys/src/view/error_boundary.rs index 30cd92a0a..f2596581c 100644 --- a/tachys/src/view/error_boundary.rs +++ b/tachys/src/view/error_boundary.rs @@ -1,17 +1,9 @@ use super::{Position, PositionState, RenderHtml}; use crate::{ hydration::Cursor, - renderer::CastFrom, ssr::StreamBuilder, view::{Mountable, Render, Renderer}, }; -use pin_project_lite::pin_project; -use std::{ - future::{Future, Ready}, - marker::PhantomData, - pin::Pin, - task::{Context, Poll}, -}; use throw_error::Error as AnyError; impl Render for Result diff --git a/tachys/src/view/iterators.rs b/tachys/src/view/iterators.rs index 6ddf7af2e..0e802fc0b 100644 --- a/tachys/src/view/iterators.rs +++ b/tachys/src/view/iterators.rs @@ -1,17 +1,6 @@ use super::{Mountable, Position, PositionState, Render, RenderHtml}; -use crate::{ - hydration::Cursor, - renderer::{CastFrom, Renderer}, - ssr::StreamBuilder, -}; -use futures::future::JoinAll; +use crate::{hydration::Cursor, renderer::Renderer, ssr::StreamBuilder}; use itertools::Itertools; -use pin_project_lite::pin_project; -use std::{ - future::Future, - pin::Pin, - task::{Context, Poll}, -}; impl Render for Option where diff --git a/tachys/src/view/keyed.rs b/tachys/src/view/keyed.rs index 2c4b8a59b..11586c5a7 100644 --- a/tachys/src/view/keyed.rs +++ b/tachys/src/view/keyed.rs @@ -8,7 +8,6 @@ use drain_filter_polyfill::VecExt as VecDrainFilterExt; use indexmap::IndexSet; use rustc_hash::FxHasher; use std::{ - future::Future, hash::{BuildHasherDefault, Hash}, marker::PhantomData, }; diff --git a/tachys/src/view/primitives.rs b/tachys/src/view/primitives.rs index 32f82ebc2..05bc32c28 100644 --- a/tachys/src/view/primitives.rs +++ b/tachys/src/view/primitives.rs @@ -6,7 +6,6 @@ use crate::{ }; use std::{ fmt::Write, - future::{ready, Ready}, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}, num::{ NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, diff --git a/tachys/src/view/static_types.rs b/tachys/src/view/static_types.rs index 4147a3c5f..1d17e990e 100644 --- a/tachys/src/view/static_types.rs +++ b/tachys/src/view/static_types.rs @@ -6,10 +6,7 @@ use crate::{ hydration::Cursor, renderer::Renderer, }; -use std::{ - future::{ready, Ready}, - marker::PhantomData, -}; +use std::marker::PhantomData; /// An attribute for which both the key and the value are known at compile time, /// i.e., as `&'static str`s. diff --git a/tachys/src/view/strings.rs b/tachys/src/view/strings.rs index d75bbd07c..d22e5a91c 100644 --- a/tachys/src/view/strings.rs +++ b/tachys/src/view/strings.rs @@ -5,12 +5,7 @@ use crate::{ hydration::Cursor, renderer::{CastFrom, Renderer}, }; -use std::{ - borrow::Cow, - future::{ready, Ready}, - rc::Rc, - sync::Arc, -}; +use std::{borrow::Cow, rc::Rc, sync::Arc}; pub struct StrState<'a, R: Renderer> { pub node: R::Text, diff --git a/tachys/src/view/tuples.rs b/tachys/src/view/tuples.rs index ee10e5752..ee584e8ab 100644 --- a/tachys/src/view/tuples.rs +++ b/tachys/src/view/tuples.rs @@ -10,12 +10,6 @@ use crate::{ use const_str_slice_concat::{ const_concat, const_concat_with_separator, str_from_buffer, }; -use pin_project_lite::pin_project; -use std::{ - future::{ready, Future, Ready}, - pin::Pin, - task::{Context, Poll}, -}; impl Render for () { type State = ();