@@ -501,13 +501,13 @@ where
501501 carry = (P, (PP,N)), push (P', (_PP', K'))
502502 */
503503 if !carry_entry. is_empty ( ) {
504- if carry_entry. key . is_some ( ) {
505- move_to_key_or_upper_bound ( input_wrapper, carry_entry . key . as_ref ( ) . unwrap ( ) ) ;
504+ if let Some ( ref carry_entry_key ) = carry_entry. key {
505+ move_to_key_or_upper_bound ( input_wrapper, carry_entry_key ) ;
506506 let weight = key_val_weight_up_to_time ( input_wrapper, time) ;
507507 log:: debug!( "pushing carry entry {carry_entry:?}" , ) ;
508508 push_insert_replace (
509509 output_wrapper,
510- & carry_entry . key . clone ( ) . unwrap ( ) ,
510+ & carry_entry_key . clone ( ) ,
511511 & ( carry_entry. prev , carry_entry. next . clone ( ) ) ,
512512 & carry_entry. time . unwrap ( ) ,
513513 & weight. unwrap ( ) ,
@@ -615,28 +615,34 @@ where
615615 */
616616
617617 //normalize carry_entry, to get rid of some cases to consider
618-
619- if carry_entry. key . is_some ( ) && !carry_entry. key . eq ( & prev) {
620- move_to_key_or_upper_bound ( input_wrapper, carry_entry. key . as_ref ( ) . unwrap ( ) ) ;
621- let weight = key_val_weight_up_to_time ( input_wrapper, time) ;
622- push_insert_replace (
623- output_wrapper,
624- carry_entry. key . as_ref ( ) . unwrap ( ) ,
625- & ( carry_entry. prev , carry_entry. next . clone ( ) ) ,
626- carry_entry. time . as_ref ( ) . unwrap ( ) ,
627- & weight. unwrap ( ) ,
628- batch_builder,
629- ) ;
618+ match carry_entry. key {
619+ Some ( ref carry_entry_key) if !carry_entry. key . eq ( & prev) => {
620+ move_to_key_or_upper_bound ( input_wrapper, carry_entry_key) ;
621+ let weight = key_val_weight_up_to_time ( input_wrapper, time) ;
622+ push_insert_replace (
623+ output_wrapper,
624+ carry_entry_key,
625+ & ( carry_entry. prev , carry_entry. next . clone ( ) ) ,
626+ carry_entry. time . as_ref ( ) . unwrap ( ) ,
627+ & weight. unwrap ( ) ,
628+ batch_builder,
629+ ) ;
630+ }
631+ _ => { }
630632 }
633+
631634 //if next of carried entry is less than prev, we need fix prev of key from carry-entry-next
632- if carry_entry. next . is_some ( ) && carry_entry. next . lt ( & prev) {
633- push_prev_replace (
634- output_wrapper,
635- & carry_entry. next . unwrap ( ) ,
636- carry_entry. key . as_ref ( ) ,
637- & carry_entry. time . unwrap ( ) ,
638- batch_builder,
639- ) ;
635+ match carry_entry. next {
636+ Some ( ref carry_entry_next) if carry_entry. next . lt ( & prev) => {
637+ push_prev_replace (
638+ output_wrapper,
639+ carry_entry_next,
640+ carry_entry. key . as_ref ( ) ,
641+ & carry_entry. time . unwrap ( ) ,
642+ batch_builder,
643+ ) ;
644+ }
645+ _ => { }
640646 }
641647
642648 move_to_key_or_upper_bound ( input_wrapper, prev_value) ;
@@ -739,26 +745,25 @@ fn handle_one_instance<
739745 }
740746 log:: debug!( "final carry {carry_entry:?}" ) ;
741747 if !carry_entry. is_empty ( ) {
742- if carry_entry. key . is_some ( ) {
743- move_to_key_or_upper_bound ( input_wrapper, carry_entry . key . as_ref ( ) . unwrap ( ) ) ;
748+ if let Some ( ref carry_entry_key ) = carry_entry. key {
749+ move_to_key_or_upper_bound ( input_wrapper, carry_entry_key ) ;
744750 let weight = key_val_weight_up_to_time ( input_wrapper, time) ;
745751 push_insert_replace (
746752 output_wrapper,
747- carry_entry . key . as_ref ( ) . unwrap ( ) ,
753+ carry_entry_key ,
748754 & ( carry_entry. prev , carry_entry. next . clone ( ) ) ,
749755 carry_entry. time . as_ref ( ) . unwrap ( ) ,
750756 & weight. unwrap ( ) ,
751757 batch_builder,
752758 ) ;
753759 }
754760
755- if carry_entry. next . is_some ( ) {
756- let key_to_fix = carry_entry. next . unwrap ( ) ;
757- move_to_key_or_upper_bound ( output_wrapper, & key_to_fix) ;
761+ if let Some ( carry_entry_next) = carry_entry. next {
762+ move_to_key_or_upper_bound ( output_wrapper, & carry_entry_next) ;
758763 rewind_zero_weight_val_forward ( output_wrapper, time) ;
759764 push_prev_replace (
760765 output_wrapper,
761- & key_to_fix ,
766+ & carry_entry_next ,
762767 carry_entry. key . as_ref ( ) ,
763768 carry_entry. time . as_ref ( ) . unwrap ( ) ,
764769 batch_builder,
0 commit comments