Jelajahi Sumber

Chore: move todo!() to unimplemented!() (#2558)

Jonathan Kelley 1 tahun lalu
induk
melakukan
47ab4c8db9

+ 2 - 2
packages/core/src/diff/node.rs

@@ -454,7 +454,7 @@ impl VNode {
     /// # use dioxus::prelude::*;
     /// # use dioxus::prelude::*;
     /// # let enabled = true;
     /// # let enabled = true;
     /// # #[component]
     /// # #[component]
-    /// # fn Component(enabled_sign: String) -> Element { todo!() }
+    /// # fn Component(enabled_sign: String) -> Element { unimplemented!() }
     /// if enabled {
     /// if enabled {
     ///     rsx!{ Component { enabled_sign: "abc" } }
     ///     rsx!{ Component { enabled_sign: "abc" } }
     /// } else {
     /// } else {
@@ -468,7 +468,7 @@ impl VNode {
     /// ```rust, no_run
     /// ```rust, no_run
     /// # use dioxus::prelude::*;
     /// # use dioxus::prelude::*;
     /// # #[component]
     /// # #[component]
-    /// # fn Component(enabled_sign: String) -> Element { todo!() }
+    /// # fn Component(enabled_sign: String) -> Element { unimplemented!() }
     /// # let enabled = true;
     /// # let enabled = true;
     /// let props = if enabled {
     /// let props = if enabled {
     ///     ComponentProps { enabled_sign: "abc".to_string() }
     ///     ComponentProps { enabled_sign: "abc".to_string() }

+ 1 - 1
packages/core/src/error_boundary.rs

@@ -455,7 +455,7 @@ impl<
 ///
 ///
 /// ```rust
 /// ```rust
 /// # use dioxus::prelude::*;
 /// # use dioxus::prelude::*;
-/// # fn ThrowsError() -> Element { todo!() }
+/// # fn ThrowsError() -> Element { unimplemented!() }
 /// rsx! {
 /// rsx! {
 ///     ErrorBoundary {
 ///     ErrorBoundary {
 ///         handle_error: |error| rsx! { "Oops, we encountered an error. Please report {error} to the developer of this application" },
 ///         handle_error: |error| rsx! { "Oops, we encountered an error. Please report {error} to the developer of this application" },

+ 2 - 2
packages/core/src/virtual_dom.rs

@@ -151,10 +151,10 @@ use tracing::instrument;
 /// #         Self {}
 /// #         Self {}
 /// #     }
 /// #     }
 /// #     fn apply(&mut self) -> Mutations {
 /// #     fn apply(&mut self) -> Mutations {
-/// #         todo!()
+/// #         unimplemented!()
 /// #     }
 /// #     }
 /// #     async fn wait_for_event(&mut self) -> std::rc::Rc<dyn std::any::Any> {
 /// #     async fn wait_for_event(&mut self) -> std::rc::Rc<dyn std::any::Any> {
-/// #         todo!()
+/// #         unimplemented!()
 /// #     }
 /// #     }
 /// # }
 /// # }
 /// #
 /// #

+ 1 - 1
packages/fullstack/src/axum_adapter.rs

@@ -220,7 +220,7 @@ where
                 Method::GET => self.route(path, get(handler)),
                 Method::GET => self.route(path, get(handler)),
                 Method::POST => self.route(path, post(handler)),
                 Method::POST => self.route(path, post(handler)),
                 Method::PUT => self.route(path, put(handler)),
                 Method::PUT => self.route(path, put(handler)),
-                _ => todo!(),
+                _ => unimplemented!("Unsupported server function method: {}", method),
             };
             };
         }
         }
 
 

+ 1 - 1
packages/hooks/src/use_sorted.rs

@@ -14,7 +14,7 @@ pub fn use_sorted<V: 'static, T: PartialEq>(
 //     I: DerefMut<Target = [T]> + Clone + PartialEq,
 //     I: DerefMut<Target = [T]> + Clone + PartialEq,
 {
 {
     use_memo(move || {
     use_memo(move || {
-        todo!()
+        unimplemented!()
         // let mut iterable = collection();
         // let mut iterable = collection();
         // iterable.sort();
         // iterable.sort();
         // iterable
         // iterable

+ 4 - 4
packages/html/src/elements.rs

@@ -230,7 +230,7 @@ macro_rules! impl_element {
         /// ```rust, no_run
         /// ```rust, no_run
         /// # use dioxus::prelude::*;
         /// # use dioxus::prelude::*;
         /// # let attributes = vec![];
         /// # let attributes = vec![];
-        /// # fn ChildComponent() -> Element { todo!() }
+        /// # fn ChildComponent() -> Element { unimplemented!() }
         /// # let raw_expression: Element = rsx! {};
         /// # let raw_expression: Element = rsx! {};
         /// rsx! {
         /// rsx! {
         ///     // Elements are followed by braces that surround any attributes and children for that element
         ///     // 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
         /// ```rust, no_run
         /// # use dioxus::prelude::*;
         /// # use dioxus::prelude::*;
         /// # let attributes = vec![];
         /// # let attributes = vec![];
-        /// # fn ChildComponent() -> Element { todo!() }
+        /// # fn ChildComponent() -> Element { unimplemented!() }
         /// # let raw_expression: Element = rsx! {};
         /// # let raw_expression: Element = rsx! {};
         /// rsx! {
         /// rsx! {
         ///     // Elements are followed by braces that surround any attributes and children for that element
         ///     // 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
         /// ```rust, no_run
         /// # use dioxus::prelude::*;
         /// # use dioxus::prelude::*;
         /// # let attributes = vec![];
         /// # let attributes = vec![];
-        /// # fn ChildComponent() -> Element { todo!() }
+        /// # fn ChildComponent() -> Element { unimplemented!() }
         /// # let raw_expression: Element = rsx! {};
         /// # let raw_expression: Element = rsx! {};
         /// rsx! {
         /// rsx! {
         ///     // Elements are followed by braces that surround any attributes and children for that element
         ///     // 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
                     /// ```rust, no_run
                     /// # use dioxus::prelude::*;
                     /// # use dioxus::prelude::*;
                     /// # let attributes = vec![];
                     /// # let attributes = vec![];
-                    /// # fn ChildComponent() -> Element { todo!() }
+                    /// # fn ChildComponent() -> Element { unimplemented!() }
                     /// # let raw_expression: Element = rsx! {};
                     /// # let raw_expression: Element = rsx! {};
                     /// rsx! {
                     /// rsx! {
                     ///     // Elements are followed by braces that surround any attributes and children for that element
                     ///     // Elements are followed by braces that surround any attributes and children for that element

+ 7 - 7
packages/router/src/routable.rs

@@ -64,7 +64,7 @@ impl<E: Display> Display for RouteParseError<E> {
 ///
 ///
 /// # #[component]
 /// # #[component]
 /// # fn Home(query: CustomQuery) -> Element {
 /// # fn Home(query: CustomQuery) -> Element {
-/// #     todo!()
+/// #     unimplemented!()
 /// # }
 /// # }
 /// ```
 /// ```
 #[rustversion::attr(
 #[rustversion::attr(
@@ -132,7 +132,7 @@ impl<T: for<'a> From<&'a str>> FromQuery for T {
 ///
 ///
 /// # #[component]
 /// # #[component]
 /// # fn Home(query: CustomQuery, other: i32) -> Element {
 /// # fn Home(query: CustomQuery, other: i32) -> Element {
-/// #     todo!()
+/// #     unimplemented!()
 /// # }
 /// # }
 /// ```
 /// ```
 #[rustversion::attr(
 #[rustversion::attr(
@@ -190,7 +190,7 @@ where
 ///
 ///
 /// #[component]
 /// #[component]
 /// fn Home(url_hash: State) -> Element {
 /// fn Home(url_hash: State) -> Element {
-///     todo!()
+///     unimplemented!()
 /// }
 /// }
 ///
 ///
 ///
 ///
@@ -217,7 +217,7 @@ where
 ///
 ///
 ///         let first = first.parse().unwrap();
 ///         let first = first.parse().unwrap();
 ///         let second = second.parse().unwrap();
 ///         let second = second.parse().unwrap();
-///         
+///
 ///         State {
 ///         State {
 ///             count: first,
 ///             count: first,
 ///             other_count: second,
 ///             other_count: second,
@@ -301,7 +301,7 @@ where
 ///
 ///
 /// # #[component]
 /// # #[component]
 /// # fn Home(route_segment_one: CustomRouteSegment, route_segment_two: i32) -> Element {
 /// # fn Home(route_segment_one: CustomRouteSegment, route_segment_two: i32) -> Element {
-/// #     todo!()
+/// #     unimplemented!()
 /// # }
 /// # }
 /// ```
 /// ```
 #[rustversion::attr(
 #[rustversion::attr(
@@ -388,7 +388,7 @@ fn full_circle() {
 ///
 ///
 /// # #[component]
 /// # #[component]
 /// # fn Home(numeric_route_segments: NumericRouteSegments) -> Element {
 /// # fn Home(numeric_route_segments: NumericRouteSegments) -> Element {
-/// #     todo!()
+/// #     unimplemented!()
 /// # }
 /// # }
 /// ```
 /// ```
 pub trait ToRouteSegments {
 pub trait ToRouteSegments {
@@ -478,7 +478,7 @@ fn to_route_segments() {
 ///
 ///
 /// # #[component]
 /// # #[component]
 /// # fn Home(numeric_route_segments: NumericRouteSegments) -> Element {
 /// # fn Home(numeric_route_segments: NumericRouteSegments) -> Element {
-/// #     todo!()
+/// #     unimplemented!()
 /// # }
 /// # }
 /// ```
 /// ```
 #[rustversion::attr(
 #[rustversion::attr(

+ 4 - 4
packages/router/tests/site_map.rs

@@ -22,22 +22,22 @@ fn with_class() {
 
 
     #[component]
     #[component]
     fn Test() -> Element {
     fn Test() -> Element {
-        todo!()
+        unimplemented!()
     }
     }
 
 
     #[component]
     #[component]
     fn Root() -> Element {
     fn Root() -> Element {
-        todo!()
+        unimplemented!()
     }
     }
 
 
     #[component]
     #[component]
     fn ChildRoot() -> Element {
     fn ChildRoot() -> Element {
-        todo!()
+        unimplemented!()
     }
     }
 
 
     #[component]
     #[component]
     fn NotStatic(not_static: String) -> Element {
     fn NotStatic(not_static: String) -> Element {
-        todo!()
+        unimplemented!()
     }
     }
 
 
     assert_eq!(
     assert_eq!(

+ 1 - 1
packages/server-macro/src/lib.rs

@@ -53,7 +53,7 @@ use syn::__private::ToTokens;
 ///   output = Json
 ///   output = Json
 /// )]
 /// )]
 /// pub async fn my_wacky_server_fn(input: Vec<String>) -> Result<usize, ServerFnError> {
 /// pub async fn my_wacky_server_fn(input: Vec<String>) -> Result<usize, ServerFnError> {
-///   todo!()
+///   unimplemented!()
 /// }
 /// }
 ///
 ///
 /// // expands to
 /// // expands to

+ 9 - 9
packages/signals/src/signal.rs

@@ -272,13 +272,13 @@ impl<T: 'static, S: Storage<SignalData<T>>> Signal<T, S> {
     /// main.rs:
     /// main.rs:
     /// ```rust, no_run
     /// ```rust, no_run
     /// # use dioxus::prelude::*;
     /// # use dioxus::prelude::*;
-    /// # fn Child() -> Element { todo!() }
+    /// # fn Child() -> Element { unimplemented!() }
     /// fn app() -> Element {
     /// fn app() -> Element {
     ///     let signal = use_context_provider(|| Signal::new(0));
     ///     let signal = use_context_provider(|| Signal::new(0));
-    ///     
+    ///
     ///     // We want to log the value of the signal whenever the app component reruns
     ///     // We want to log the value of the signal whenever the app component reruns
     ///     println!("{}", *signal.read());
     ///     println!("{}", *signal.read());
-    ///     
+    ///
     ///     rsx! {
     ///     rsx! {
     ///         button {
     ///         button {
     ///             // If we don't want to rerun the app component when the button is clicked, we can use write_silent
     ///             // 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<T: 'static, S: Storage<SignalData<T>>> Signal<T, S> {
     /// # use dioxus::prelude::*;
     /// # use dioxus::prelude::*;
     /// fn Child() -> Element {
     /// fn Child() -> Element {
     ///     let signal: Signal<i32> = use_context();
     ///     let signal: Signal<i32> = 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
     ///     // 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! {
     ///     rsx! {
     ///         "{signal}"
     ///         "{signal}"
@@ -308,13 +308,13 @@ impl<T: 'static, S: Storage<SignalData<T>>> Signal<T, S> {
     /// main.rs:
     /// main.rs:
     /// ```rust, no_run
     /// ```rust, no_run
     /// # use dioxus::prelude::*;
     /// # use dioxus::prelude::*;
-    /// # fn Child() -> Element { todo!() }
+    /// # fn Child() -> Element { unimplemented!() }
     /// fn app() -> Element {
     /// fn app() -> Element {
     ///     let mut signal = use_context_provider(|| Signal::new(0));
     ///     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
     ///     // 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());
     ///     println!("{}", *signal.peek());
-    ///     
+    ///
     ///     rsx! {
     ///     rsx! {
     ///         button {
     ///         button {
     ///             // We can use write like normal and update the child component automatically
     ///             // We can use write like normal and update the child component automatically
@@ -330,7 +330,7 @@ impl<T: 'static, S: Storage<SignalData<T>>> Signal<T, S> {
     /// # use dioxus::prelude::*;
     /// # use dioxus::prelude::*;
     /// fn Child() -> Element {
     /// fn Child() -> Element {
     ///     let signal: Signal<i32> = use_context();
     ///     let signal: Signal<i32> = use_context();
-    ///     
+    ///
     ///     rsx! {
     ///     rsx! {
     ///         "{signal}"
     ///         "{signal}"
     ///     }
     ///     }
@@ -550,7 +550,7 @@ struct Counts {
 
 
 fn app() -> Element {
 fn app() -> Element {
     let mut counts = use_signal(|| Counts { count1: 0, count2: 0 });
     let mut counts = use_signal(|| Counts { count1: 0, count2: 0 });
-    
+
     use_effect(move || {
     use_effect(move || {
         // This effect both reads and writes to counts
         // This effect both reads and writes to counts
         counts.write().count1 = counts().count2;
         counts.write().count1 = counts().count2;