@@ -31,7 +31,7 @@ fn convert_log2_denom_ceil(numer: &mut BigInt, old_log2_denom: usize, new_log2_d
31
31
if new_log2_denom >= old_log2_denom {
32
32
* numer <<= new_log2_denom - old_log2_denom;
33
33
} else {
34
- let mut numer_value = mem:: replace ( numer, Default :: default ( ) ) ;
34
+ let mut numer_value = mem:: take ( numer) ;
35
35
numer_value = -numer_value;
36
36
numer_value >>= old_log2_denom - new_log2_denom;
37
37
numer_value = -numer_value;
@@ -202,7 +202,7 @@ impl DyadicFractionInterval {
202
202
pub fn set_negative_one ( & mut self ) {
203
203
self . lower_bound_numer . set_one ( ) ;
204
204
self . lower_bound_numer <<= self . log2_denom ;
205
- self . lower_bound_numer = -mem:: replace ( & mut self . lower_bound_numer , Default :: default ( ) ) ;
205
+ self . lower_bound_numer = -mem:: take ( & mut self . lower_bound_numer ) ;
206
206
self . upper_bound_numer . clone_from ( & self . lower_bound_numer ) ;
207
207
}
208
208
pub fn into_ratio_range ( self ) -> ( Ratio < BigInt > , Ratio < BigInt > ) {
@@ -462,7 +462,7 @@ impl DyadicFractionInterval {
462
462
self
463
463
}
464
464
pub fn square_assign ( & mut self ) {
465
- * self = mem:: replace ( self , Default :: default ( ) ) . into_square ( ) ;
465
+ * self = mem:: take ( self ) . into_square ( ) ;
466
466
}
467
467
pub fn square ( & self ) -> Self {
468
468
self . clone ( ) . into_square ( )
@@ -493,7 +493,7 @@ impl DyadicFractionInterval {
493
493
}
494
494
}
495
495
pub fn sqrt_assign ( & mut self ) {
496
- * self = mem:: replace ( self , Default :: default ( ) ) . into_sqrt ( ) ;
496
+ * self = mem:: take ( self ) . into_sqrt ( ) ;
497
497
}
498
498
pub fn into_sqrt ( self ) -> Self {
499
499
Self :: do_sqrt ( Cow :: Owned ( self ) )
@@ -774,10 +774,10 @@ impl DyadicFractionInterval {
774
774
pub fn abs_assign ( & mut self ) {
775
775
let contains_zero = self . contains_zero ( ) ;
776
776
if self . lower_bound_numer . is_negative ( ) {
777
- self . lower_bound_numer = -mem:: replace ( & mut self . lower_bound_numer , Default :: default ( ) ) ;
777
+ self . lower_bound_numer = -mem:: take ( & mut self . lower_bound_numer ) ;
778
778
}
779
779
if self . upper_bound_numer . is_negative ( ) {
780
- self . upper_bound_numer = -mem:: replace ( & mut self . upper_bound_numer , Default :: default ( ) ) ;
780
+ self . upper_bound_numer = -mem:: take ( & mut self . upper_bound_numer ) ;
781
781
}
782
782
if self . lower_bound_numer > self . upper_bound_numer {
783
783
mem:: swap ( & mut self . lower_bound_numer , & mut self . upper_bound_numer ) ;
@@ -807,12 +807,12 @@ impl DyadicFractionInterval {
807
807
self . clone ( ) . into_floor ( new_log2_denom)
808
808
}
809
809
pub fn ceil_assign ( & mut self , new_log2_denom : usize ) {
810
- self . lower_bound_numer = -mem:: replace ( & mut self . lower_bound_numer , Default :: default ( ) ) ;
811
- self . upper_bound_numer = -mem:: replace ( & mut self . upper_bound_numer , Default :: default ( ) ) ;
810
+ self . lower_bound_numer = -mem:: take ( & mut self . lower_bound_numer ) ;
811
+ self . upper_bound_numer = -mem:: take ( & mut self . upper_bound_numer ) ;
812
812
self . lower_bound_numer >>= self . log2_denom ;
813
813
self . upper_bound_numer >>= self . log2_denom ;
814
- self . lower_bound_numer = -mem:: replace ( & mut self . lower_bound_numer , Default :: default ( ) ) ;
815
- self . upper_bound_numer = -mem:: replace ( & mut self . upper_bound_numer , Default :: default ( ) ) ;
814
+ self . lower_bound_numer = -mem:: take ( & mut self . lower_bound_numer ) ;
815
+ self . upper_bound_numer = -mem:: take ( & mut self . upper_bound_numer ) ;
816
816
self . log2_denom = 0 ;
817
817
self . convert_log2_denom ( new_log2_denom) ;
818
818
}
0 commit comments