@@ -92,13 +92,13 @@ fn check_combination_rules(
9292
9393 // Check each combination length
9494 for combo in & combinations {
95- if let ElementCode :: JumpCombination ( jumps) = combo {
96- if jumps. len ( ) > 3 {
97- violations . push ( Violation :: CombinationTooLong {
98- element : combo . notation ( ) ,
99- jump_count : jumps . len ( ) ,
100- } ) ;
101- }
95+ if let ElementCode :: JumpCombination ( jumps) = combo
96+ && jumps. len ( ) > 3
97+ {
98+ violations . push ( Violation :: CombinationTooLong {
99+ element : combo . notation ( ) ,
100+ jump_count : jumps . len ( ) ,
101+ } ) ;
102102 }
103103 }
104104
@@ -166,12 +166,7 @@ mod tests {
166166
167167 /// Helper: create a jump combination element.
168168 fn combo ( jumps : Vec < ( u8 , JumpType ) > ) -> ElementCode {
169- ElementCode :: JumpCombination (
170- jumps
171- . into_iter ( )
172- . map ( |( r, jt) | Jump :: new ( r, jt) )
173- . collect ( ) ,
174- )
169+ ElementCode :: JumpCombination ( jumps. into_iter ( ) . map ( |( r, jt) | Jump :: new ( r, jt) ) . collect ( ) )
175170 }
176171
177172 /// Helper: create a spin element.
@@ -195,7 +190,11 @@ mod tests {
195190 combo( vec![ ( 3 , JumpType :: Salchow ) , ( 2 , JumpType :: Toeloop ) ] ) ,
196191 solo_jump( 2 , JumpType :: Axel ) ,
197192 solo_jump( 3 , JumpType :: Loop ) ,
198- combo( vec![ ( 2 , JumpType :: Axel ) , ( 1 , JumpType :: Loop ) , ( 2 , JumpType :: Salchow ) ] ) ,
193+ combo( vec![
194+ ( 2 , JumpType :: Axel ) ,
195+ ( 1 , JumpType :: Loop ) ,
196+ ( 2 , JumpType :: Salchow ) ,
197+ ] ) ,
199198 solo_jump( 2 , JumpType :: Lutz ) ,
200199 spin( ) ,
201200 spin( ) ,
@@ -204,7 +203,11 @@ mod tests {
204203 step( ) ,
205204 ] ;
206205 let violations = validate_program ( & elements, Segment :: Free ) ;
207- assert ! ( violations. is_empty( ) , "Expected no violations, got: {:?}" , violations) ;
206+ assert ! (
207+ violations. is_empty( ) ,
208+ "Expected no violations, got: {:?}" ,
209+ violations
210+ ) ;
208211 }
209212
210213 #[ test]
@@ -217,7 +220,13 @@ mod tests {
217220 ] ;
218221 let violations = validate_program ( & elements, Segment :: Free ) ;
219222 assert ! (
220- violations. iter( ) . any( |v| matches!( v, Violation :: ZayakRule { jump_type: JumpType :: Lutz , count: 3 } ) ) ,
223+ violations. iter( ) . any( |v| matches!(
224+ v,
225+ Violation :: ZayakRule {
226+ jump_type: JumpType :: Lutz ,
227+ count: 3
228+ }
229+ ) ) ,
221230 "Expected Zayak violation for Lutz, got: {:?}" ,
222231 violations
223232 ) ;
@@ -235,7 +244,11 @@ mod tests {
235244 . iter ( )
236245 . filter ( |v| matches ! ( v, Violation :: ZayakRule { .. } ) )
237246 . collect ( ) ;
238- assert ! ( zayak_violations. is_empty( ) , "Expected no Zayak violations, got: {:?}" , zayak_violations) ;
247+ assert ! (
248+ zayak_violations. is_empty( ) ,
249+ "Expected no Zayak violations, got: {:?}" ,
250+ zayak_violations
251+ ) ;
239252 }
240253
241254 #[ test]
@@ -269,7 +282,13 @@ mod tests {
269282 ] ;
270283 let violations = validate_program ( & elements, Segment :: Free ) ;
271284 assert ! (
272- violations. iter( ) . any( |v| matches!( v, Violation :: TooManyJumpElements { found: 8 , maximum: 7 } ) ) ,
285+ violations. iter( ) . any( |v| matches!(
286+ v,
287+ Violation :: TooManyJumpElements {
288+ found: 8 ,
289+ maximum: 7
290+ }
291+ ) ) ,
273292 "Expected TooManyJumpElements, got: {:?}" ,
274293 violations
275294 ) ;
@@ -286,7 +305,13 @@ mod tests {
286305 ] ;
287306 let violations = validate_program ( & elements, Segment :: Short ) ;
288307 assert ! (
289- violations. iter( ) . any( |v| matches!( v, Violation :: TooManyJumpElements { found: 4 , maximum: 3 } ) ) ,
308+ violations. iter( ) . any( |v| matches!(
309+ v,
310+ Violation :: TooManyJumpElements {
311+ found: 4 ,
312+ maximum: 3
313+ }
314+ ) ) ,
290315 "Expected TooManyJumpElements for short program, got: {:?}" ,
291316 violations
292317 ) ;
@@ -303,7 +328,9 @@ mod tests {
303328 ] ) ] ;
304329 let violations = validate_program ( & elements, Segment :: Free ) ;
305330 assert ! (
306- violations. iter( ) . any( |v| matches!( v, Violation :: CombinationTooLong { .. } ) ) ,
331+ violations
332+ . iter( )
333+ . any( |v| matches!( v, Violation :: CombinationTooLong { .. } ) ) ,
307334 "Expected CombinationTooLong, got: {:?}" ,
308335 violations
309336 ) ;
@@ -319,7 +346,13 @@ mod tests {
319346 ] ;
320347 let violations = validate_program ( & elements, Segment :: Short ) ;
321348 assert ! (
322- violations. iter( ) . any( |v| matches!( v, Violation :: TooManyCombinations { found: 2 , maximum: 1 } ) ) ,
349+ violations. iter( ) . any( |v| matches!(
350+ v,
351+ Violation :: TooManyCombinations {
352+ found: 2 ,
353+ maximum: 1
354+ }
355+ ) ) ,
323356 "Expected TooManyCombinations, got: {:?}" ,
324357 violations
325358 ) ;
0 commit comments