@@ -32,7 +32,7 @@ use dioxus::prelude::*;
3232struct NoKeysProps {
3333 data : std:: collections:: HashMap < u32 , String > ,
3434}
35- static AntipatternNoKeys : FC < NoKeysProps > = |( cx, props) | {
35+ static AntipatternNoKeys : FC < NoKeysProps > = |cx, props| {
3636 // WRONG: Make sure to add keys!
3737 rsx ! ( cx, ul {
3838 { props. data. iter( ) . map( |( k, v) | rsx!( li { "List item: {v}" } ) ) }
@@ -54,7 +54,7 @@ static AntipatternNoKeys: FC<NoKeysProps> = |(cx, props)| {
5454///
5555/// Only Component and Fragment nodes are susceptible to this issue. Dioxus mitigates this with components by providing
5656/// an API for registering shared state without the ContextProvider pattern.
57- static AntipatternNestedFragments : FC < ( ) > = |( cx, props) | {
57+ static AntipatternNestedFragments : FC < ( ) > = |cx, props| {
5858 // Try to avoid heavily nesting fragments
5959 rsx ! ( cx,
6060 Fragment {
@@ -82,7 +82,7 @@ static AntipatternNestedFragments: FC<()> = |(cx, props)| {
8282/// However, calling set_state will *not* update the current version of state in the component. This should be easy to
8383/// recognize from the function signature, but Dioxus will not update the "live" version of state. Calling `set_state`
8484/// merely places a new value in the queue and schedules the component for a future update.
85- static AntipatternRelyingOnSetState : FC < ( ) > = |( cx, props) | {
85+ static AntipatternRelyingOnSetState : FC < ( ) > = |cx, props| {
8686 let ( state, set_state) = use_state ( cx, || "Hello world" ) . classic ( ) ;
8787 set_state ( "New state" ) ;
8888 // This will return false! `state` will *still* be "Hello world"
@@ -99,7 +99,7 @@ static AntipatternRelyingOnSetState: FC<()> = |(cx, props)| {
9999/// - All components must start with an uppercase character
100100///
101101/// i.e.: the following component will be rejected when attempted to be used in the rsx! macro
102- static antipattern_component: FC < ( ) > = |( cx, props) | todo ! ( ) ;
102+ static antipattern_component: FC < ( ) > = |cx, props| todo ! ( ) ;
103103
104104/// Antipattern: Misusing hooks
105105/// ---------------------------
@@ -120,7 +120,7 @@ static antipattern_component: FC<()> = |(cx, props)| todo!();
120120struct MisuedHooksProps {
121121 should_render_state : bool ,
122122}
123- static AntipatternMisusedHooks : FC < MisuedHooksProps > = |( cx, props) | {
123+ static AntipatternMisusedHooks : FC < MisuedHooksProps > = |cx, props| {
124124 if props. should_render_state {
125125 // do not place a hook in the conditional!
126126 // prefer to move it out of the conditional
@@ -153,7 +153,7 @@ static AntipatternMisusedHooks: FC<MisuedHooksProps> = |(cx, props)| {
153153/// }
154154/// }
155155/// })
156- static _example: FC < ( ) > = |( cx, props) | todo ! ( ) ;
156+ static _example: FC < ( ) > = |cx, props| todo ! ( ) ;
157157
158158/// Antipattern: publishing components and hooks with all features enabled
159159/// ----------------------------------------------------------------------
@@ -171,9 +171,9 @@ static _example: FC<()> = |(cx, props)| todo!();
171171///
172172/// This will only include the `core` dioxus crate which is relatively slim and fast to compile and avoids target-specific
173173/// libraries.
174- static __example: FC < ( ) > = |( cx, props) | todo ! ( ) ;
174+ static __example: FC < ( ) > = |cx, props| todo ! ( ) ;
175175
176- pub static Example : FC < ( ) > = |( cx, props) | {
176+ pub static Example : FC < ( ) > = |cx, props| {
177177 cx. render ( rsx ! {
178178 AntipatternNoKeys { data: std:: collections:: HashMap :: new( ) }
179179 AntipatternNestedFragments { }
0 commit comments