@@ -80,7 +80,9 @@ impl CreateMarket {
8080 let periods = match app. node . get_all_slot_quarters ( ) {
8181 Ok ( p) => p,
8282 Err ( e) => {
83- tracing:: warn!( "Failed to load periods for slot dropdown: {e:#}" ) ;
83+ tracing:: warn!(
84+ "Failed to load periods for slot dropdown: {e:#}"
85+ ) ;
8486 self . slots_loaded = true ;
8587 return ;
8688 }
@@ -92,8 +94,10 @@ impl CreateMarket {
9294 Ok ( slots) => {
9395 for slot in slots {
9496 if let Some ( decision) = & slot. decision {
95- let slot_id_hex = hex:: encode ( slot. slot_id . as_bytes ( ) ) ;
96- let claiming_txid_bytes: [ u8 ; 32 ] = slot. claiming_txid . into ( ) ;
97+ let slot_id_hex =
98+ hex:: encode ( slot. slot_id . as_bytes ( ) ) ;
99+ let claiming_txid_bytes: [ u8 ; 32 ] =
100+ slot. claiming_txid . into ( ) ;
97101
98102 self . claimed_slots . push ( ClaimedSlotInfo {
99103 slot_id_hex : slot_id_hex. clone ( ) ,
@@ -112,7 +116,9 @@ impl CreateMarket {
112116 }
113117 }
114118 Err ( e) => {
115- tracing:: warn!( "Failed to load slots for period {period}: {e:#}" ) ;
119+ tracing:: warn!(
120+ "Failed to load slots for period {period}: {e:#}"
121+ ) ;
116122 }
117123 }
118124 }
@@ -131,7 +137,9 @@ impl CreateMarket {
131137 . dimensions
132138 . iter ( )
133139 . filter_map ( |dim| {
134- if dim. slot_ids . is_empty ( ) || dim. slot_ids . iter ( ) . all ( |s| s. is_empty ( ) ) {
140+ if dim. slot_ids . is_empty ( )
141+ || dim. slot_ids . iter ( ) . all ( |s| s. is_empty ( ) )
142+ {
135143 return None ;
136144 }
137145
@@ -144,7 +152,14 @@ impl CreateMarket {
144152
145153 if dim. is_categorical && non_empty. len ( ) >= 2 {
146154 // Categorical: [slot1,slot2,slot3]
147- Some ( format ! ( "[{}]" , non_empty. iter( ) . map( |s| s. as_str( ) ) . collect:: <Vec <_>>( ) . join( "," ) ) )
155+ Some ( format ! (
156+ "[{}]" ,
157+ non_empty
158+ . iter( )
159+ . map( |s| s. as_str( ) )
160+ . collect:: <Vec <_>>( )
161+ . join( "," )
162+ ) )
148163 } else if !non_empty. is_empty ( ) {
149164 // Single: just the slot id
150165 Some ( non_empty[ 0 ] . clone ( ) )
@@ -165,7 +180,8 @@ impl CreateMarket {
165180 let mut count = 1usize ;
166181
167182 for dim in & self . dimensions {
168- let non_empty_slots = dim. slot_ids . iter ( ) . filter ( |s| !s. is_empty ( ) ) . count ( ) ;
183+ let non_empty_slots =
184+ dim. slot_ids . iter ( ) . filter ( |s| !s. is_empty ( ) ) . count ( ) ;
169185 if non_empty_slots == 0 {
170186 continue ;
171187 }
@@ -187,7 +203,9 @@ impl CreateMarket {
187203 let dimensions = self . build_dimensions_string ( ) ;
188204
189205 if dimensions. is_none ( ) {
190- self . error = Some ( "At least one dimension with a slot is required" . to_string ( ) ) ;
206+ self . error = Some (
207+ "At least one dimension with a slot is required" . to_string ( ) ,
208+ ) ;
191209 return ;
192210 }
193211
@@ -197,7 +215,8 @@ impl CreateMarket {
197215 match self . trading_fee_input . parse :: < f64 > ( ) {
198216 Ok ( f) if ( 0.0 ..=1.0 ) . contains ( & f) => Some ( f) ,
199217 Ok ( _) => {
200- self . error = Some ( "Trading fee must be between 0 and 1" . to_string ( ) ) ;
218+ self . error =
219+ Some ( "Trading fee must be between 0 and 1" . to_string ( ) ) ;
201220 return ;
202221 }
203222 Err ( _) => {
@@ -213,7 +232,8 @@ impl CreateMarket {
213232 match self . initial_liquidity_input . parse :: < u64 > ( ) {
214233 Ok ( l) => Some ( l) ,
215234 Err ( _) => {
216- self . error = Some ( "Invalid initial liquidity value" . to_string ( ) ) ;
235+ self . error =
236+ Some ( "Invalid initial liquidity value" . to_string ( ) ) ;
217237 return ;
218238 }
219239 }
@@ -235,7 +255,11 @@ impl CreateMarket {
235255 let txids: Vec < [ u8 ; 32 ] > = self
236256 . dimensions
237257 . iter ( )
238- . filter ( |d| d. is_categorical && d. slot_ids . len ( ) >= 2 && !d. category_txid . is_empty ( ) )
258+ . filter ( |d| {
259+ d. is_categorical
260+ && d. slot_ids . len ( ) >= 2
261+ && !d. category_txid . is_empty ( )
262+ } )
239263 . filter_map ( |d| {
240264 hex:: decode ( & d. category_txid ) . ok ( ) . and_then ( |bytes| {
241265 if bytes. len ( ) == 32 {
@@ -248,11 +272,7 @@ impl CreateMarket {
248272 } )
249273 } )
250274 . collect ( ) ;
251- if txids. is_empty ( ) {
252- None
253- } else {
254- Some ( txids)
255- }
275+ if txids. is_empty ( ) { None } else { Some ( txids) }
256276 } ;
257277
258278 let residual_names: Option < Vec < String > > = {
@@ -263,11 +283,7 @@ impl CreateMarket {
263283 . map ( |d| d. residual_name . clone ( ) )
264284 . filter ( |s| !s. is_empty ( ) )
265285 . collect ( ) ;
266- if names. is_empty ( ) {
267- None
268- } else {
269- Some ( names)
270- }
286+ if names. is_empty ( ) { None } else { Some ( names) }
271287 } ;
272288
273289 let dimensions_str = dimensions. unwrap ( ) ;
@@ -294,8 +310,10 @@ impl CreateMarket {
294310 tracing:: error!( "Create market failed: {e:#}" ) ;
295311 } else {
296312 tracing:: info!( "Market created: {}" , self . title) ;
297- self . success_message =
298- Some ( format ! ( "Market '{}' created successfully!" , self . title) ) ;
313+ self . success_message = Some ( format ! (
314+ "Market '{}' created successfully!" ,
315+ self . title
316+ ) ) ;
299317 self . reset ( ) ;
300318 }
301319 }
0 commit comments