From c7124e41fbf82d98cf6a8fddcbc1619392a7bd49 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 13 Sep 2024 06:31:39 -0700 Subject: [PATCH] Add space between rsx and exclamation point (#2956) --- examples/errors.rs | 2 +- packages/core/src/error_boundary.rs | 6 +++--- packages/core/src/events.rs | 10 +++++----- packages/core/src/fragment.rs | 4 ++-- packages/core/src/global_context.rs | 6 +++--- packages/core/src/runtime.rs | 2 +- packages/core/src/scope_context.rs | 4 ++-- packages/core/src/virtual_dom.rs | 4 ++-- packages/fullstack/src/hooks/server_cached.rs | 2 +- packages/fullstack/src/hooks/server_future.rs | 2 +- packages/hooks/src/use_collection.rs | 2 +- packages/hooks/src/use_coroutine.rs | 2 +- packages/router/examples/simple_routes.rs | 2 +- packages/router/tests/parsing.rs | 6 +++--- packages/rsx/src/lib.rs | 2 +- packages/rsx/tests/hotreload_pattern.rs | 18 +++++++++--------- packages/rsx/tests/parsing.rs | 2 +- packages/signals/src/write.rs | 2 +- packages/web/examples/hydrate.rs | 2 +- packages/web/tests/hydrate.rs | 2 +- 20 files changed, 41 insertions(+), 41 deletions(-) diff --git a/examples/errors.rs b/examples/errors.rs index 12b7fbaa8..4727cb5e0 100644 --- a/examples/errors.rs +++ b/examples/errors.rs @@ -81,7 +81,7 @@ fn ParseNumberWithShow() -> Element { let request_data = "0.5"; let data: i32 = request_data.parse() // You can attach rsx to results that can be displayed in the Error Boundary - .show(|_| rsx!{ + .show(|_| rsx! { div { background_color: "red", border: "black", diff --git a/packages/core/src/error_boundary.rs b/packages/core/src/error_boundary.rs index 332c7f406..f9a23b935 100644 --- a/packages/core/src/error_boundary.rs +++ b/packages/core/src/error_boundary.rs @@ -106,7 +106,7 @@ pub trait Context: private::Sealed { /// "Error parsing number: {error}" /// } /// })?; - /// todo!() + /// unimplemented!() /// } /// ``` fn show(self, display_error: impl FnOnce(&E) -> Element) -> Result; @@ -120,7 +120,7 @@ pub trait Context: private::Sealed { /// // You can bubble up errors with `?` inside components, and event handlers /// // Along with the error itself, you can provide a way to display the error by calling `context` /// let number = "-1234".parse::().context("Parsing number inside of the NumberParser")?; - /// todo!() + /// unimplemented!() /// } /// ``` fn context(self, context: C) -> Result; @@ -134,7 +134,7 @@ pub trait Context: private::Sealed { /// // You can bubble up errors with `?` inside components, and event handlers /// // Along with the error itself, you can provide a way to display the error by calling `context` /// let number = "-1234".parse::().with_context(|| format!("Timestamp: {:?}", std::time::Instant::now()))?; - /// todo!() + /// unimplemented!() /// } /// ``` fn with_context(self, context: impl FnOnce() -> C) -> Result; diff --git a/packages/core/src/events.rs b/packages/core/src/events.rs index de4ef0b42..486d60cf1 100644 --- a/packages/core/src/events.rs +++ b/packages/core/src/events.rs @@ -201,7 +201,7 @@ impl std::fmt::Debug for Event { /// /// ```rust, no_run /// # use dioxus::prelude::*; -/// rsx!{ +/// rsx! { /// MyComponent { onclick: move |evt| tracing::debug!("clicked") } /// }; /// @@ -211,7 +211,7 @@ impl std::fmt::Debug for Event { /// } /// /// fn MyComponent(cx: MyProps) -> Element { -/// rsx!{ +/// rsx! { /// button { /// onclick: move |evt| cx.onclick.call(evt), /// } @@ -228,7 +228,7 @@ pub type EventHandler = Callback; /// # Example /// /// ```rust, ignore -/// rsx!{ +/// rsx! { /// MyComponent { onclick: move |evt| { /// tracing::debug!("clicked"); /// 42 @@ -241,7 +241,7 @@ pub type EventHandler = Callback; /// } /// /// fn MyComponent(cx: MyProps) -> Element { -/// rsx!{ +/// rsx! { /// button { /// onclick: move |evt| println!("number: {}", cx.onclick.call(evt)), /// } @@ -256,7 +256,7 @@ pub struct Callback { /// # use dioxus::prelude::*; /// #[component] /// fn Child(onclick: EventHandler) -> Element { - /// rsx!{ + /// rsx! { /// button { /// // Diffing Child will not rerun this component, it will just update the callback in place so that if this callback is called, it will run the latest version of the callback /// onclick: move |evt| onclick(evt), diff --git a/packages/core/src/fragment.rs b/packages/core/src/fragment.rs index 7b1681a0f..8a79f0318 100644 --- a/packages/core/src/fragment.rs +++ b/packages/core/src/fragment.rs @@ -14,7 +14,7 @@ use crate::innerlude::*; /// ```rust /// # use dioxus::prelude::*; /// let value = 1; -/// rsx!{ +/// rsx! { /// Fragment { key: "{value}" } /// }; /// ``` @@ -76,7 +76,7 @@ impl FragmentBuilder { /// /// #[component] /// fn CustomCard(children: Element) -> Element { -/// rsx!{ +/// rsx! { /// div { /// h1 {"Title card"} /// {children} diff --git a/packages/core/src/global_context.rs b/packages/core/src/global_context.rs index 92a4dfd13..2fb0f8280 100644 --- a/packages/core/src/global_context.rs +++ b/packages/core/src/global_context.rs @@ -25,13 +25,13 @@ pub fn vdom_is_rendering() -> bool { /// fn Component() -> Element { /// let request = spawn(async move { /// match reqwest::get("https://api.example.com").await { -/// Ok(_) => todo!(), +/// Ok(_) => unimplemented!(), /// // You can explicitly throw an error into a scope with throw_error /// Err(err) => ScopeId::APP.throw_error(err) /// } /// }); /// -/// todo!() +/// unimplemented!() /// } /// ``` pub fn throw_error(error: impl Into + 'static) { @@ -351,7 +351,7 @@ pub fn schedule_update_any() -> Arc { /// window.scroll_with_x_and_y(original_scroll_position(), 0.0); /// }); /// -/// rsx!{ +/// rsx! { /// div { /// id: "my_element", /// "hello" diff --git a/packages/core/src/runtime.rs b/packages/core/src/runtime.rs index c4d2b297b..b1f0f0f36 100644 --- a/packages/core/src/runtime.rs +++ b/packages/core/src/runtime.rs @@ -435,7 +435,7 @@ impl Runtime { /// } /// /// fn app() -> Element { -/// rsx!{ Component { runtime: Runtime::current().unwrap() } } +/// rsx! { Component { runtime: Runtime::current().unwrap() } } /// } /// /// // In a dynamic library diff --git a/packages/core/src/scope_context.rs b/packages/core/src/scope_context.rs index 2012b2d6f..9f77273bf 100644 --- a/packages/core/src/scope_context.rs +++ b/packages/core/src/scope_context.rs @@ -558,13 +558,13 @@ impl ScopeId { /// fn Component() -> Element { /// let request = spawn(async move { /// match reqwest::get("https://api.example.com").await { - /// Ok(_) => todo!(), + /// Ok(_) => unimplemented!(), /// // You can explicitly throw an error into a scope with throw_error /// Err(err) => ScopeId::APP.throw_error(err) /// } /// }); /// - /// todo!() + /// unimplemented!() /// } /// ``` pub fn throw_error(self, error: impl Into + 'static) { diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index 8d520a25b..6ce5718f2 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -269,7 +269,7 @@ impl VirtualDom { /// } /// /// fn Example(cx: SomeProps) -> Element { - /// rsx!{ div { "hello {cx.name}" } } + /// rsx! { div { "hello {cx.name}" } } /// } /// /// let dom = VirtualDom::new_with_props(Example, SomeProps { name: "world" }); @@ -285,7 +285,7 @@ impl VirtualDom { /// # name: &'static str /// # } /// # fn Example(cx: SomeProps) -> Element { - /// # rsx!{ div { "hello {cx.name}" } } + /// # rsx! { div { "hello {cx.name}" } } /// # } /// let mut dom = VirtualDom::new_with_props(Example, SomeProps { name: "jane" }); /// dom.rebuild_in_place(); diff --git a/packages/fullstack/src/hooks/server_cached.rs b/packages/fullstack/src/hooks/server_cached.rs index 499db0362..7e3b55a99 100644 --- a/packages/fullstack/src/hooks/server_cached.rs +++ b/packages/fullstack/src/hooks/server_cached.rs @@ -17,7 +17,7 @@ use serde::{de::DeserializeOwned, Serialize}; /// 1234 /// }); /// -/// todo!() +/// unimplemented!() /// } /// ``` pub fn use_server_cached( diff --git a/packages/fullstack/src/hooks/server_future.rs b/packages/fullstack/src/hooks/server_future.rs index 2f910c5ec..bf6893cc9 100644 --- a/packages/fullstack/src/hooks/server_future.rs +++ b/packages/fullstack/src/hooks/server_future.rs @@ -40,7 +40,7 @@ use std::future::Future; /// /// ```rust, no_run /// # use dioxus::prelude::*; -/// # async fn fetch_article(id: u32) -> String { todo!() } +/// # async fn fetch_article(id: u32) -> String { unimplemented!() } /// use dioxus::prelude::*; /// /// fn App() -> Element { diff --git a/packages/hooks/src/use_collection.rs b/packages/hooks/src/use_collection.rs index 7b38f6aed..cd61090c7 100644 --- a/packages/hooks/src/use_collection.rs +++ b/packages/hooks/src/use_collection.rs @@ -40,7 +40,7 @@ static TodoList: Component = |cx| { let todos = use_map(|| HashMap::new()); let input = use_signal(|| None); - rsx!{ + rsx! { div { button { "Add todo" diff --git a/packages/hooks/src/use_coroutine.rs b/packages/hooks/src/use_coroutine.rs index 03ed6a3d7..278d24201 100644 --- a/packages/hooks/src/use_coroutine.rs +++ b/packages/hooks/src/use_coroutine.rs @@ -61,7 +61,7 @@ use std::future::Future; /// }); /// /// -/// rsx!{ +/// rsx! { /// button { /// onclick: move |_| chat_client.send(Action::Start), /// "Start Chat Service" diff --git a/packages/router/examples/simple_routes.rs b/packages/router/examples/simple_routes.rs index 53c82dbeb..3ee695dee 100644 --- a/packages/router/examples/simple_routes.rs +++ b/packages/router/examples/simple_routes.rs @@ -92,7 +92,7 @@ fn Route1(user_id: usize, dynamic: usize, query: String) -> Element { fn Route2(user_id: usize) -> Element { rsx! { pre { "Route2{{\n\tuser_id:{user_id}\n}}" } - {(0..user_id).map(|i| rsx!{ p { "{i}" } })} + {(0..user_id).map(|i| rsx! { p { "{i}" } })} p { "Footer" } Link { to: Route::Route3 { diff --git a/packages/router/tests/parsing.rs b/packages/router/tests/parsing.rs index b2d60e19c..05dfb6537 100644 --- a/packages/router/tests/parsing.rs +++ b/packages/router/tests/parsing.rs @@ -3,17 +3,17 @@ use std::str::FromStr; #[component] fn Root() -> Element { - todo!() + unimplemented!() } #[component] fn Test() -> Element { - todo!() + unimplemented!() } #[component] fn Dynamic(id: usize) -> Element { - todo!() + unimplemented!() } // Make sure trailing '/'s work correctly diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index 4fd6c86e3..a79baaec1 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -1,7 +1,7 @@ #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")] #![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")] -//! Parse the root tokens in the rsx!{ } macro +//! Parse the root tokens in the rsx! { } macro //! ========================================= //! //! This parsing path emerges directly from the macro call, with `RsxRender` being the primary entrance into parsing. diff --git a/packages/rsx/tests/hotreload_pattern.rs b/packages/rsx/tests/hotreload_pattern.rs index 066da8c79..0d513364e 100644 --- a/packages/rsx/tests/hotreload_pattern.rs +++ b/packages/rsx/tests/hotreload_pattern.rs @@ -501,7 +501,7 @@ fn template_generates() { "width2": 100, "height2": "100px", p { "hello world" } - {(0..10).map(|i| rsx!{"{i}"})} + {(0..10).map(|i| rsx! {"{i}"})} } div { width: 120, @@ -536,9 +536,9 @@ fn diffs_complex() { "width2": 100, "height2": "100px", p { "hello world" } - {(0..10).map(|i| rsx!{"{i}"})}, - {(0..10).map(|i| rsx!{"{i}"})}, - {(0..11).map(|i| rsx!{"{i}"})}, + {(0..10).map(|i| rsx! {"{i}"})}, + {(0..10).map(|i| rsx! {"{i}"})}, + {(0..11).map(|i| rsx! {"{i}"})}, Comp {} } }; @@ -552,9 +552,9 @@ fn diffs_complex() { "height2": "100px", p { "hello world" } Comp {} - {(0..10).map(|i| rsx!{"{i}"})}, - {(0..10).map(|i| rsx!{"{i}"})}, - {(0..11).map(|i| rsx!{"{i}"})}, + {(0..10).map(|i| rsx! {"{i}"})}, + {(0..10).map(|i| rsx! {"{i}"})}, + {(0..11).map(|i| rsx! {"{i}"})}, } }; @@ -570,12 +570,12 @@ fn remove_node() { quote! { svg { Comp {} - {(0..10).map(|i| rsx!{"{i}"})}, + {(0..10).map(|i| rsx! {"{i}"})}, } }, quote! { div { - {(0..10).map(|i| rsx!{"{i}"})}, + {(0..10).map(|i| rsx! {"{i}"})}, } }, ) diff --git a/packages/rsx/tests/parsing.rs b/packages/rsx/tests/parsing.rs index edf9d60eb..6e03ef8f9 100644 --- a/packages/rsx/tests/parsing.rs +++ b/packages/rsx/tests/parsing.rs @@ -98,7 +98,7 @@ fn complex_kitchen_sink() { } })} } - div { class: "px-4", {is_current.then(|| rsx!{ children })} } + div { class: "px-4", {is_current.then(|| rsx! { children })} } } // No nesting diff --git a/packages/signals/src/write.rs b/packages/signals/src/write.rs index 9b1bf0103..46d4dda4a 100644 --- a/packages/signals/src/write.rs +++ b/packages/signals/src/write.rs @@ -17,7 +17,7 @@ pub type WritableRef<'a, T: Writable, O = ::Target> = T::Mut<'a, /// } /// /// fn MyComponent(mut count: Signal) -> Element { -/// rsx!{ +/// rsx! { /// button { /// onclick: move |_| { /// // You can use any methods from the Writable trait on Signals diff --git a/packages/web/examples/hydrate.rs b/packages/web/examples/hydrate.rs index b9c8e46f3..1cd0d9ae3 100644 --- a/packages/web/examples/hydrate.rs +++ b/packages/web/examples/hydrate.rs @@ -12,7 +12,7 @@ fn app() -> Element { "asd" Bapp {} } - {(0..10).map(|f| rsx!{ + {(0..10).map(|f| rsx! { div { "thing {f}" } diff --git a/packages/web/tests/hydrate.rs b/packages/web/tests/hydrate.rs index ffb678b32..a409a4a75 100644 --- a/packages/web/tests/hydrate.rs +++ b/packages/web/tests/hydrate.rs @@ -35,7 +35,7 @@ fn rehydrates() { }, "listener test" } - {false.then(|| rsx!{ "hello" })} + {false.then(|| rsx! { "hello" })} } } }