From 47ab4c8db966e7ee60492326fd2a24f1acda4cde Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Thu, 27 Jun 2024 14:27:27 -0700 Subject: [PATCH] Chore: move todo!() to unimplemented!() (#2558) --- packages/core/src/diff/node.rs | 4 ++-- packages/core/src/error_boundary.rs | 2 +- packages/core/src/virtual_dom.rs | 4 ++-- packages/fullstack/src/axum_adapter.rs | 2 +- packages/hooks/src/use_sorted.rs | 2 +- packages/html/src/elements.rs | 8 ++++---- packages/router/src/routable.rs | 14 +++++++------- packages/router/tests/site_map.rs | 8 ++++---- packages/server-macro/src/lib.rs | 2 +- packages/signals/src/signal.rs | 18 +++++++++--------- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/core/src/diff/node.rs b/packages/core/src/diff/node.rs index 3753245c7..ff54ba869 100644 --- a/packages/core/src/diff/node.rs +++ b/packages/core/src/diff/node.rs @@ -454,7 +454,7 @@ impl VNode { /// # use dioxus::prelude::*; /// # let enabled = true; /// # #[component] - /// # fn Component(enabled_sign: String) -> Element { todo!() } + /// # fn Component(enabled_sign: String) -> Element { unimplemented!() } /// if enabled { /// rsx!{ Component { enabled_sign: "abc" } } /// } else { @@ -468,7 +468,7 @@ impl VNode { /// ```rust, no_run /// # use dioxus::prelude::*; /// # #[component] - /// # fn Component(enabled_sign: String) -> Element { todo!() } + /// # fn Component(enabled_sign: String) -> Element { unimplemented!() } /// # let enabled = true; /// let props = if enabled { /// ComponentProps { enabled_sign: "abc".to_string() } diff --git a/packages/core/src/error_boundary.rs b/packages/core/src/error_boundary.rs index ae1e2609f..a9f4f8044 100644 --- a/packages/core/src/error_boundary.rs +++ b/packages/core/src/error_boundary.rs @@ -455,7 +455,7 @@ impl< /// /// ```rust /// # use dioxus::prelude::*; -/// # fn ThrowsError() -> Element { todo!() } +/// # fn ThrowsError() -> Element { unimplemented!() } /// rsx! { /// ErrorBoundary { /// handle_error: |error| rsx! { "Oops, we encountered an error. Please report {error} to the developer of this application" }, diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index d803be2b2..e2ef2ff4e 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -151,10 +151,10 @@ use tracing::instrument; /// # Self {} /// # } /// # fn apply(&mut self) -> Mutations { -/// # todo!() +/// # unimplemented!() /// # } /// # async fn wait_for_event(&mut self) -> std::rc::Rc { -/// # todo!() +/// # unimplemented!() /// # } /// # } /// # diff --git a/packages/fullstack/src/axum_adapter.rs b/packages/fullstack/src/axum_adapter.rs index 228535889..1d47838f1 100644 --- a/packages/fullstack/src/axum_adapter.rs +++ b/packages/fullstack/src/axum_adapter.rs @@ -220,7 +220,7 @@ where Method::GET => self.route(path, get(handler)), Method::POST => self.route(path, post(handler)), Method::PUT => self.route(path, put(handler)), - _ => todo!(), + _ => unimplemented!("Unsupported server function method: {}", method), }; } diff --git a/packages/hooks/src/use_sorted.rs b/packages/hooks/src/use_sorted.rs index 627ed3124..f293e4b10 100644 --- a/packages/hooks/src/use_sorted.rs +++ b/packages/hooks/src/use_sorted.rs @@ -14,7 +14,7 @@ pub fn use_sorted( // I: DerefMut + Clone + PartialEq, { use_memo(move || { - todo!() + unimplemented!() // let mut iterable = collection(); // iterable.sort(); // iterable diff --git a/packages/html/src/elements.rs b/packages/html/src/elements.rs index 2f2737119..4be34e568 100644 --- a/packages/html/src/elements.rs +++ b/packages/html/src/elements.rs @@ -230,7 +230,7 @@ macro_rules! impl_element { /// ```rust, no_run /// # use dioxus::prelude::*; /// # let attributes = vec![]; - /// # fn ChildComponent() -> Element { todo!() } + /// # fn ChildComponent() -> Element { unimplemented!() } /// # let raw_expression: Element = rsx! {}; /// rsx! { /// // Elements are followed by braces that surround any attributes and children for that element @@ -283,7 +283,7 @@ macro_rules! impl_element { /// ```rust, no_run /// # use dioxus::prelude::*; /// # let attributes = vec![]; - /// # fn ChildComponent() -> Element { todo!() } + /// # fn ChildComponent() -> Element { unimplemented!() } /// # let raw_expression: Element = rsx! {}; /// rsx! { /// // Elements are followed by braces that surround any attributes and children for that element @@ -337,7 +337,7 @@ macro_rules! impl_element { /// ```rust, no_run /// # use dioxus::prelude::*; /// # let attributes = vec![]; - /// # fn ChildComponent() -> Element { todo!() } + /// # fn ChildComponent() -> Element { unimplemented!() } /// # let raw_expression: Element = rsx! {}; /// rsx! { /// // Elements are followed by braces that surround any attributes and children for that element @@ -584,7 +584,7 @@ macro_rules! builder_constructors { /// ```rust, no_run /// # use dioxus::prelude::*; /// # let attributes = vec![]; - /// # fn ChildComponent() -> Element { todo!() } + /// # fn ChildComponent() -> Element { unimplemented!() } /// # let raw_expression: Element = rsx! {}; /// rsx! { /// // Elements are followed by braces that surround any attributes and children for that element diff --git a/packages/router/src/routable.rs b/packages/router/src/routable.rs index 6eaaa3f1a..555706923 100644 --- a/packages/router/src/routable.rs +++ b/packages/router/src/routable.rs @@ -64,7 +64,7 @@ impl Display for RouteParseError { /// /// # #[component] /// # fn Home(query: CustomQuery) -> Element { -/// # todo!() +/// # unimplemented!() /// # } /// ``` #[rustversion::attr( @@ -132,7 +132,7 @@ impl From<&'a str>> FromQuery for T { /// /// # #[component] /// # fn Home(query: CustomQuery, other: i32) -> Element { -/// # todo!() +/// # unimplemented!() /// # } /// ``` #[rustversion::attr( @@ -190,7 +190,7 @@ where /// /// #[component] /// fn Home(url_hash: State) -> Element { -/// todo!() +/// unimplemented!() /// } /// /// @@ -217,7 +217,7 @@ where /// /// let first = first.parse().unwrap(); /// let second = second.parse().unwrap(); -/// +/// /// State { /// count: first, /// other_count: second, @@ -301,7 +301,7 @@ where /// /// # #[component] /// # fn Home(route_segment_one: CustomRouteSegment, route_segment_two: i32) -> Element { -/// # todo!() +/// # unimplemented!() /// # } /// ``` #[rustversion::attr( @@ -388,7 +388,7 @@ fn full_circle() { /// /// # #[component] /// # fn Home(numeric_route_segments: NumericRouteSegments) -> Element { -/// # todo!() +/// # unimplemented!() /// # } /// ``` pub trait ToRouteSegments { @@ -478,7 +478,7 @@ fn to_route_segments() { /// /// # #[component] /// # fn Home(numeric_route_segments: NumericRouteSegments) -> Element { -/// # todo!() +/// # unimplemented!() /// # } /// ``` #[rustversion::attr( diff --git a/packages/router/tests/site_map.rs b/packages/router/tests/site_map.rs index c44e2afb2..325256789 100644 --- a/packages/router/tests/site_map.rs +++ b/packages/router/tests/site_map.rs @@ -22,22 +22,22 @@ fn with_class() { #[component] fn Test() -> Element { - todo!() + unimplemented!() } #[component] fn Root() -> Element { - todo!() + unimplemented!() } #[component] fn ChildRoot() -> Element { - todo!() + unimplemented!() } #[component] fn NotStatic(not_static: String) -> Element { - todo!() + unimplemented!() } assert_eq!( diff --git a/packages/server-macro/src/lib.rs b/packages/server-macro/src/lib.rs index 97f9b0675..a397a1da8 100644 --- a/packages/server-macro/src/lib.rs +++ b/packages/server-macro/src/lib.rs @@ -53,7 +53,7 @@ use syn::__private::ToTokens; /// output = Json /// )] /// pub async fn my_wacky_server_fn(input: Vec) -> Result { -/// todo!() +/// unimplemented!() /// } /// /// // expands to diff --git a/packages/signals/src/signal.rs b/packages/signals/src/signal.rs index abe3f7afa..8f4558e9b 100644 --- a/packages/signals/src/signal.rs +++ b/packages/signals/src/signal.rs @@ -272,13 +272,13 @@ impl>> Signal { /// main.rs: /// ```rust, no_run /// # use dioxus::prelude::*; - /// # fn Child() -> Element { todo!() } + /// # fn Child() -> Element { unimplemented!() } /// fn app() -> Element { /// let signal = use_context_provider(|| Signal::new(0)); - /// + /// /// // We want to log the value of the signal whenever the app component reruns /// println!("{}", *signal.read()); - /// + /// /// rsx! { /// button { /// // If we don't want to rerun the app component when the button is clicked, we can use write_silent @@ -294,7 +294,7 @@ impl>> Signal { /// # use dioxus::prelude::*; /// fn Child() -> Element { /// let signal: Signal = use_context(); - /// + /// /// // It is difficult to tell that changing the button to use write_silent in the main.rs file will cause UI to be out of sync in a completely different file /// rsx! { /// "{signal}" @@ -308,13 +308,13 @@ impl>> Signal { /// main.rs: /// ```rust, no_run /// # use dioxus::prelude::*; - /// # fn Child() -> Element { todo!() } + /// # fn Child() -> Element { unimplemented!() } /// fn app() -> Element { /// let mut signal = use_context_provider(|| Signal::new(0)); - /// + /// /// // We want to log the value of the signal whenever the app component reruns, but we don't want to rerun the app component when the signal is updated so we use peek instead of read /// println!("{}", *signal.peek()); - /// + /// /// rsx! { /// button { /// // We can use write like normal and update the child component automatically @@ -330,7 +330,7 @@ impl>> Signal { /// # use dioxus::prelude::*; /// fn Child() -> Element { /// let signal: Signal = use_context(); - /// + /// /// rsx! { /// "{signal}" /// } @@ -550,7 +550,7 @@ struct Counts { fn app() -> Element { let mut counts = use_signal(|| Counts { count1: 0, count2: 0 }); - + use_effect(move || { // This effect both reads and writes to counts counts.write().count1 = counts().count2;