mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 14:44:12 +00:00
fix clippy
This commit is contained in:
parent
cc94711d62
commit
d2ec27e761
4 changed files with 7 additions and 10 deletions
|
@ -49,11 +49,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn default_external_navigation_handler<R>() -> fn(Scope) -> Element
|
||||
where
|
||||
R: dioxus_router::prelude::Routable,
|
||||
<R as std::str::FromStr>::Err: std::fmt::Display,
|
||||
{
|
||||
fn default_external_navigation_handler() -> fn(Scope) -> Element {
|
||||
dioxus_router::prelude::FailureExternalNavigation
|
||||
}
|
||||
|
||||
|
@ -65,7 +61,7 @@ where
|
|||
<R as std::str::FromStr>::Err: std::fmt::Display,
|
||||
{
|
||||
#[serde(skip)]
|
||||
#[serde(default = "default_external_navigation_handler::<R>")]
|
||||
#[serde(default = "default_external_navigation_handler")]
|
||||
failure_external_navigation: fn(Scope) -> Element,
|
||||
scroll_restoration: bool,
|
||||
#[serde(skip)]
|
||||
|
|
|
@ -198,7 +198,7 @@ pub fn Link<'a>(cx: Scope<'a, LinkProps<'a>>) -> Element {
|
|||
IntoRoutable::Route(route) => router.any_route_to_string(&**route),
|
||||
};
|
||||
let parsed_route: NavigationTarget<Box<dyn Any>> = match router.route_from_str(&href) {
|
||||
Ok(route) => NavigationTarget::Internal(route.into()),
|
||||
Ok(route) => NavigationTarget::Internal(route),
|
||||
Err(err) => NavigationTarget::External(err),
|
||||
};
|
||||
let ac = active_class
|
||||
|
|
|
@ -19,6 +19,8 @@ pub struct ExternalNavigationFailure(String);
|
|||
|
||||
/// A function the router will call after every routing update.
|
||||
pub(crate) type RoutingCallback<R> = Arc<dyn Fn(LinkContext<R>) -> Option<NavigationTarget<R>>>;
|
||||
pub(crate) type AnyRoutingCallback =
|
||||
Arc<dyn Fn(RouterContext) -> Option<NavigationTarget<Box<dyn Any>>>>;
|
||||
|
||||
struct MutableRouterState {
|
||||
/// The current prefix.
|
||||
|
@ -36,7 +38,7 @@ pub struct RouterContext {
|
|||
|
||||
subscribers: Arc<RwLock<HashSet<ScopeId>>>,
|
||||
subscriber_update: Arc<dyn Fn(ScopeId)>,
|
||||
routing_callback: Option<Arc<dyn Fn(RouterContext) -> Option<NavigationTarget<Box<dyn Any>>>>>,
|
||||
routing_callback: Option<AnyRoutingCallback>,
|
||||
|
||||
failure_external_navigation: fn(Scope) -> Element,
|
||||
|
||||
|
@ -250,7 +252,7 @@ impl RouterContext {
|
|||
IntoRoutable::Route(route) => self.any_route_to_string(&**route),
|
||||
};
|
||||
let parsed_route: NavigationTarget<Box<dyn Any>> = match self.route_from_str(&href) {
|
||||
Ok(route) => NavigationTarget::Internal(route.into()),
|
||||
Ok(route) => NavigationTarget::Internal(route),
|
||||
Err(err) => NavigationTarget::External(err),
|
||||
};
|
||||
parsed_route
|
||||
|
|
|
@ -279,7 +279,6 @@ pub trait HistoryProvider<R: Routable> {
|
|||
}
|
||||
|
||||
pub(crate) trait AnyHistoryProvider {
|
||||
#[must_use]
|
||||
fn parse_route(&self, route: &str) -> Result<Box<dyn Any>, String>;
|
||||
|
||||
#[must_use]
|
||||
|
|
Loading…
Reference in a new issue