@@ -739,20 +739,16 @@ where
739739
740740 match value {
741741 Some ( value) => {
742- let existing_value = existing_state_cell. as_ref ( ) ;
743-
744- let old_value = if let Some ( old_value) = existing_value {
745- old_value. provisional_value_ref ( & ts)
746- } else {
747- None
748- } ;
749-
750- if let Some ( old_value) = old_value {
751- output_updates. push ( ( old_value. clone ( ) , ts. clone ( ) , -1 ) ) ;
742+ if let Some ( old_value) = existing_state_cell. as_ref ( ) {
743+ if let Some ( old_value) = old_value. provisional_value_ref ( & ts) {
744+ output_updates. push ( ( old_value. clone ( ) , ts. clone ( ) , -1 ) ) ;
745+ }
752746 }
753747
754748 match & drain_style {
755749 DrainStyle :: AtTime { .. } => {
750+ let existing_value = existing_state_cell. take ( ) ;
751+
756752 let new_value = match existing_value {
757753 Some ( existing_value) => existing_value. clone ( ) . into_provisional_value (
758754 value. clone ( ) ,
@@ -765,6 +761,7 @@ where
765761 Some ( from_time. 0 . clone ( ) ) ,
766762 ) ,
767763 } ;
764+
768765 existing_state_cell. replace ( new_value) ;
769766 }
770767 DrainStyle :: ToUpper { .. } => {
@@ -775,19 +772,16 @@ where
775772 output_updates. push ( ( value, ts, 1 ) ) ;
776773 }
777774 None => {
778- let existing_value = existing_state_cell. take ( ) ;
779-
780- let old_value = if let Some ( old_value) = existing_value. as_ref ( ) {
781- old_value. provisional_value_ref ( & ts)
782- } else {
783- None
784- } ;
785- if let Some ( old_value) = old_value {
786- output_updates. push ( ( old_value. clone ( ) , ts. clone ( ) , -1 ) ) ;
775+ if let Some ( old_value) = existing_state_cell. as_ref ( ) {
776+ if let Some ( old_value) = old_value. provisional_value_ref ( & ts) {
777+ output_updates. push ( ( old_value. clone ( ) , ts. clone ( ) , -1 ) ) ;
778+ }
787779 }
788780
789781 match & drain_style {
790782 DrainStyle :: AtTime { .. } => {
783+ let existing_value = existing_state_cell. take ( ) ;
784+
791785 let new_value = match existing_value {
792786 Some ( existing_value) => existing_value
793787 . into_provisional_tombstone ( ts. clone ( ) , Some ( from_time. 0 . clone ( ) ) ) ,
@@ -796,6 +790,7 @@ where
796790 Some ( from_time. 0 . clone ( ) ) ,
797791 ) ,
798792 } ;
793+
799794 existing_state_cell. replace ( new_value) ;
800795 }
801796 DrainStyle :: ToUpper { .. } => {
0 commit comments