From 362e3bc60352f76036bdc5bed80f7d44dd47638b Mon Sep 17 00:00:00 2001 From: martin frances Date: Fri, 17 Nov 2023 20:36:13 +0000 Subject: [PATCH] chore: stop using std::fmt, instead used core::fmt. (#2033) --- integrations/axum/src/lib.rs | 14 +++++++------- leptos_dom/src/events/typed.rs | 4 ++-- leptos_dom/src/helpers.rs | 4 ++-- leptos_dom/src/hydration.rs | 2 +- leptos_dom/src/lib.rs | 2 +- leptos_dom/src/macro_helpers/into_attribute.rs | 6 +++--- leptos_dom/src/macro_helpers/into_style.rs | 4 ++-- leptos_dom/src/nonce.rs | 2 +- leptos_hot_reload/src/lib.rs | 4 ++-- leptos_reactive/src/hydration.rs | 4 ++-- leptos_reactive/src/runtime.rs | 2 +- leptos_reactive/src/selector.rs | 4 ++-- leptos_reactive/src/signal_wrappers_read.rs | 10 +++++----- leptos_reactive/src/signal_wrappers_write.rs | 6 +++--- leptos_reactive/src/suspense.rs | 4 ++-- meta/src/body.rs | 4 ++-- meta/src/html.rs | 4 ++-- meta/src/lib.rs | 4 ++-- meta/src/title.rs | 4 ++-- router/src/components/redirect.rs | 6 +++--- router/src/components/route.rs | 10 +++++----- router/src/components/router.rs | 4 ++-- router/src/components/static_render.rs | 2 +- router/src/history/mod.rs | 4 ++-- router/src/history/params.rs | 2 +- router/src/matching/route.rs | 4 ++-- server_fn/src/error.rs | 2 +- 27 files changed, 61 insertions(+), 61 deletions(-) diff --git a/integrations/axum/src/lib.rs b/integrations/axum/src/lib.rs index d7627ed0a..e389f3ea8 100644 --- a/integrations/axum/src/lib.rs +++ b/integrations/axum/src/lib.rs @@ -384,7 +384,7 @@ async fn handle_server_fns_inner( Response::builder().status(StatusCode::BAD_REQUEST).body( Full::from(format!( "Could not find a server function at the route \ - {fn_name}. \n\nIt's likely that either + {fn_name}. \n\nIt's likely that either 1. The API prefix you specify in the `#[server]` \ macro doesn't match the prefix at which your server \ function handler is mounted, or \n2. You are on a \ @@ -1835,8 +1835,8 @@ impl ExtractorHelper { where S: Sized, F: Extractor, - T: std::fmt::Debug + Send + FromRequestParts + 'static, - T::Rejection: std::fmt::Debug + Send + 'static, + T: core::fmt::Debug + Send + FromRequestParts + 'static, + T::Rejection: core::fmt::Debug + Send + 'static, { let mut parts = self.parts.lock().await; let data = T::from_request_parts(&mut parts, &s).await?; @@ -1879,8 +1879,8 @@ pub async fn extract( f: impl Extractor, ) -> Result where - T: std::fmt::Debug + Send + FromRequestParts<()> + 'static, - T::Rejection: std::fmt::Debug + Send + 'static, + T: core::fmt::Debug + Send + FromRequestParts<()> + 'static, + T::Rejection: core::fmt::Debug + Send + 'static, { extract_with_state((), f).await } @@ -1947,8 +1947,8 @@ pub async fn extract_with_state( ) -> Result where S: Sized, - T: std::fmt::Debug + Send + FromRequestParts + 'static, - T::Rejection: std::fmt::Debug + Send + 'static, + T: core::fmt::Debug + Send + FromRequestParts + 'static, + T::Rejection: core::fmt::Debug + Send + 'static, { use_context::() .expect( diff --git a/leptos_dom/src/events/typed.rs b/leptos_dom/src/events/typed.rs index a45def352..ad512f35b 100644 --- a/leptos_dom/src/events/typed.rs +++ b/leptos_dom/src/events/typed.rs @@ -324,8 +324,8 @@ macro_rules! generate_event_types { )* } - impl ::std::fmt::Debug for GenericEventHandler { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + impl ::core::fmt::Debug for GenericEventHandler { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { $( Self::[< $($event:camel)+ >](event, _) => f diff --git a/leptos_dom/src/helpers.rs b/leptos_dom/src/helpers.rs index 01cf4601d..3dbb269b2 100644 --- a/leptos_dom/src/helpers.rs +++ b/leptos_dom/src/helpers.rs @@ -458,8 +458,8 @@ where /// A handle that can be called to remove a global event listener. pub struct WindowListenerHandle(Box); -impl std::fmt::Debug for WindowListenerHandle { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for WindowListenerHandle { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_tuple("WindowListenerHandle").finish() } } diff --git a/leptos_dom/src/hydration.rs b/leptos_dom/src/hydration.rs index 62fcf2725..104ec175f 100644 --- a/leptos_dom/src/hydration.rs +++ b/leptos_dom/src/hydration.rs @@ -84,7 +84,7 @@ pub struct HydrationKey { } impl Display for HydrationKey { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!( f, "{}-{}-{}-{}", diff --git a/leptos_dom/src/lib.rs b/leptos_dom/src/lib.rs index 4d26905fe..d7461f2a9 100644 --- a/leptos_dom/src/lib.rs +++ b/leptos_dom/src/lib.rs @@ -1179,7 +1179,7 @@ where } } -impl IntoView for std::fmt::Arguments<'_> { +impl IntoView for core::fmt::Arguments<'_> { #[cfg_attr( any(debug_assertions, feature = "ssr"), instrument(level = "info", name = "#text", skip_all) diff --git a/leptos_dom/src/macro_helpers/into_attribute.rs b/leptos_dom/src/macro_helpers/into_attribute.rs index d6c514a47..7e2b75b2f 100644 --- a/leptos_dom/src/macro_helpers/into_attribute.rs +++ b/leptos_dom/src/macro_helpers/into_attribute.rs @@ -88,8 +88,8 @@ impl PartialEq for Attribute { } } -impl std::fmt::Debug for Attribute { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for Attribute { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::String(arg0) => f.debug_tuple("String").field(arg0).finish(), Self::Fn(_) => f.debug_tuple("Fn").finish(), @@ -278,7 +278,7 @@ impl IntoAttribute for TextProp { impl_into_attr_boxed! {} } -impl IntoAttribute for std::fmt::Arguments<'_> { +impl IntoAttribute for core::fmt::Arguments<'_> { fn into_attribute(self) -> Attribute { match self.as_str() { Some(s) => s.into_attribute(), diff --git a/leptos_dom/src/macro_helpers/into_style.rs b/leptos_dom/src/macro_helpers/into_style.rs index 11c5d5cde..c1a0cc464 100644 --- a/leptos_dom/src/macro_helpers/into_style.rs +++ b/leptos_dom/src/macro_helpers/into_style.rs @@ -27,8 +27,8 @@ impl PartialEq for Style { } } -impl std::fmt::Debug for Style { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for Style { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::Value(arg0) => f.debug_tuple("Value").field(arg0).finish(), Self::Fn(_) => f.debug_tuple("Fn").finish(), diff --git a/leptos_dom/src/nonce.rs b/leptos_dom/src/nonce.rs index e1ef41122..1969b68de 100644 --- a/leptos_dom/src/nonce.rs +++ b/leptos_dom/src/nonce.rs @@ -54,7 +54,7 @@ impl Deref for Nonce { } impl Display for Nonce { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.0) } } diff --git a/leptos_hot_reload/src/lib.rs b/leptos_hot_reload/src/lib.rs index 48f0707ff..02f33330e 100644 --- a/leptos_hot_reload/src/lib.rs +++ b/leptos_hot_reload/src/lib.rs @@ -131,8 +131,8 @@ pub struct MacroInvocation { template: LNode, } -impl std::fmt::Debug for MacroInvocation { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for MacroInvocation { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("MacroInvocation") .field("id", &self.id) .finish_non_exhaustive() diff --git a/leptos_reactive/src/hydration.rs b/leptos_reactive/src/hydration.rs index ada41c4ea..936e68f35 100644 --- a/leptos_reactive/src/hydration.rs +++ b/leptos_reactive/src/hydration.rs @@ -242,8 +242,8 @@ pub struct FragmentData { pub local_only: bool, } -impl std::fmt::Debug for SharedContext { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for SharedContext { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("SharedContext").finish() } } diff --git a/leptos_reactive/src/runtime.rs b/leptos_reactive/src/runtime.rs index 013645c4d..9099a2bff 100644 --- a/leptos_reactive/src/runtime.rs +++ b/leptos_reactive/src/runtime.rs @@ -675,7 +675,7 @@ impl Runtime { } impl Debug for Runtime { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("Runtime").finish() } } diff --git a/leptos_reactive/src/selector.rs b/leptos_reactive/src/selector.rs index e36536ca7..3c10f3648 100644 --- a/leptos_reactive/src/selector.rs +++ b/leptos_reactive/src/selector.rs @@ -111,11 +111,11 @@ where f: Rc bool>, } -impl std::fmt::Debug for Selector +impl core::fmt::Debug for Selector where T: PartialEq + Eq + Clone + Hash + 'static, { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("Selector").finish() } } diff --git a/leptos_reactive/src/signal_wrappers_read.rs b/leptos_reactive/src/signal_wrappers_read.rs index 55d47aea8..d703a6ee9 100644 --- a/leptos_reactive/src/signal_wrappers_read.rs +++ b/leptos_reactive/src/signal_wrappers_read.rs @@ -91,8 +91,8 @@ impl Clone for Signal { impl Copy for Signal {} -impl std::fmt::Debug for Signal { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for Signal { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut s = f.debug_struct("Signal"); s.field("inner", &self.inner); #[cfg(any(debug_assertions, feature = "ssr"))] @@ -458,8 +458,8 @@ impl Clone for SignalTypes { impl Copy for SignalTypes {} -impl std::fmt::Debug for SignalTypes { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for SignalTypes { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::ReadSignal(arg0) => { f.debug_tuple("ReadSignal").field(arg0).finish() @@ -1313,7 +1313,7 @@ impl TextProp { } impl Debug for TextProp { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_tuple("TextProp").finish() } } diff --git a/leptos_reactive/src/signal_wrappers_write.rs b/leptos_reactive/src/signal_wrappers_write.rs index f094cccf4..0bdd5231a 100644 --- a/leptos_reactive/src/signal_wrappers_write.rs +++ b/leptos_reactive/src/signal_wrappers_write.rs @@ -234,11 +234,11 @@ impl Clone for SignalSetterTypes { impl Copy for SignalSetterTypes {} -impl std::fmt::Debug for SignalSetterTypes +impl core::fmt::Debug for SignalSetterTypes where - T: std::fmt::Debug, + T: core::fmt::Debug, { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::Write(arg0) => { f.debug_tuple("WriteSignal").field(arg0).finish() diff --git a/leptos_reactive/src/suspense.rs b/leptos_reactive/src/suspense.rs index 603c51343..e50d550c6 100644 --- a/leptos_reactive/src/suspense.rs +++ b/leptos_reactive/src/suspense.rs @@ -291,8 +291,8 @@ pub enum StreamChunk { }, } -impl std::fmt::Debug for StreamChunk { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for StreamChunk { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { StreamChunk::Sync(data) => write!(f, "StreamChunk::Sync({data:?})"), StreamChunk::Async { .. } => write!(f, "StreamChunk::Async(_)"), diff --git a/meta/src/body.rs b/meta/src/body.rs index e5eb078a6..c9a1ad3f0 100644 --- a/meta/src/body.rs +++ b/meta/src/body.rs @@ -55,8 +55,8 @@ impl BodyContext { } } -impl std::fmt::Debug for BodyContext { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for BodyContext { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_tuple("TitleContext").finish() } } diff --git a/meta/src/html.rs b/meta/src/html.rs index bcf231025..39d6b6c35 100644 --- a/meta/src/html.rs +++ b/meta/src/html.rs @@ -70,8 +70,8 @@ impl HtmlContext { } } -impl std::fmt::Debug for HtmlContext { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for HtmlContext { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_tuple("TitleContext").finish() } } diff --git a/meta/src/lib.rs b/meta/src/lib.rs index 75746203d..e5883e1da 100644 --- a/meta/src/lib.rs +++ b/meta/src/lib.rs @@ -106,8 +106,8 @@ pub struct MetaTagsContext { >, } -impl std::fmt::Debug for MetaTagsContext { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for MetaTagsContext { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("MetaTagsContext").finish() } } diff --git a/meta/src/title.rs b/meta/src/title.rs index d2d41a4b6..9d884ba78 100644 --- a/meta/src/title.rs +++ b/meta/src/title.rs @@ -28,8 +28,8 @@ impl TitleContext { } } -impl std::fmt::Debug for TitleContext { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for TitleContext { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_tuple("TitleContext").finish() } } diff --git a/router/src/components/redirect.rs b/router/src/components/redirect.rs index a96a8860d..1aabb5841 100644 --- a/router/src/components/redirect.rs +++ b/router/src/components/redirect.rs @@ -32,7 +32,7 @@ pub fn Redirect

( options: Option, ) -> impl IntoView where - P: std::fmt::Display + 'static, + P: core::fmt::Display + 'static, { // resolve relative path let path = use_resolved_path(move || path.to_string()); @@ -68,8 +68,8 @@ pub struct ServerRedirectFunction { f: Rc, } -impl std::fmt::Debug for ServerRedirectFunction { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for ServerRedirectFunction { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("ServerRedirectFunction").finish() } } diff --git a/router/src/components/route.rs b/router/src/components/route.rs index c673f539a..62e119946 100644 --- a/router/src/components/route.rs +++ b/router/src/components/route.rs @@ -72,7 +72,7 @@ pub fn Route( where E: IntoView, F: Fn() -> E + 'static, - P: std::fmt::Display, + P: core::fmt::Display, { define_route( children, @@ -122,7 +122,7 @@ pub fn ProtectedRoute( where E: IntoView, F: Fn() -> E + 'static, - P: std::fmt::Display + 'static, + P: core::fmt::Display + 'static, C: Fn() -> bool + 'static, { use crate::Redirect; @@ -178,7 +178,7 @@ pub fn StaticRoute( where E: IntoView, F: Fn() -> E + 'static, - P: std::fmt::Display, + P: core::fmt::Display, S: Fn() -> Pin + Send + Sync>> + Send + Sync @@ -407,8 +407,8 @@ impl PartialEq for RouteContextInner { } } -impl std::fmt::Debug for RouteContextInner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for RouteContextInner { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("RouteContextInner") .field("path", &self.path) .field("ParamsMap", &self.params) diff --git a/router/src/components/router.rs b/router/src/components/router.rs index 95e5d2a98..5de3ad1c0 100644 --- a/router/src/components/router.rs +++ b/router/src/components/router.rs @@ -66,8 +66,8 @@ pub(crate) struct RouterContextInner { pub(crate) path_stack: StoredValue>, } -impl std::fmt::Debug for RouterContextInner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for RouterContextInner { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("RouterContextInner") .field("location", &self.location) .field("base", &self.base) diff --git a/router/src/components/static_render.rs b/router/src/components/static_render.rs index d3c96824f..81712d252 100644 --- a/router/src/components/static_render.rs +++ b/router/src/components/static_render.rs @@ -161,7 +161,7 @@ impl StaticPath<'_, '_> {} pub struct ResolvedStaticPath(pub String); impl Display for ResolvedStaticPath { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.0.fmt(f) } } diff --git a/router/src/history/mod.rs b/router/src/history/mod.rs index 16921b7ca..a55fe294c 100644 --- a/router/src/history/mod.rs +++ b/router/src/history/mod.rs @@ -12,8 +12,8 @@ pub use location::*; pub use params::*; pub use state::*; -impl std::fmt::Debug for RouterIntegrationContext { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for RouterIntegrationContext { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("RouterIntegrationContext").finish() } } diff --git a/router/src/history/params.rs b/router/src/history/params.rs index 9e0115c96..4a90b0b75 100644 --- a/router/src/history/params.rs +++ b/router/src/history/params.rs @@ -78,7 +78,7 @@ impl Default for ParamsMap { /// # use leptos_router::params_map; /// let map = params_map! { /// "crate" => "leptos", -/// 42 => true, // where key & val: std::fmt::Display +/// 42 => true, // where key & val: core::fmt::Display /// }; /// assert_eq!(map.get("crate"), Some(&"leptos".to_string())); /// assert_eq!(map.get("42"), Some(&true.to_string())) diff --git a/router/src/matching/route.rs b/router/src/matching/route.rs index f5f6d1c9c..24fe6b67e 100644 --- a/router/src/matching/route.rs +++ b/router/src/matching/route.rs @@ -27,8 +27,8 @@ pub struct RouteDefinition { pub static_params: Option, } -impl std::fmt::Debug for RouteDefinition { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for RouteDefinition { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("RouteDefinition") .field("path", &self.path) .field("children", &self.children) diff --git a/server_fn/src/error.rs b/server_fn/src/error.rs index 6f621c4aa..8d3ec910e 100644 --- a/server_fn/src/error.rs +++ b/server_fn/src/error.rs @@ -72,7 +72,7 @@ pub enum ServerFnError { MissingArg(String), } -impl std::fmt::Display for ServerFnError { +impl core::fmt::Display for ServerFnError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f,