@@ -377,8 +377,7 @@ impl<T: Float + AddAssign> AddAssign for NotNan<T> {
377377/// Panics if the provided value is NaN.
378378impl < T : Float + AddAssign > AddAssign < T > for NotNan < T > {
379379 fn add_assign ( & mut self , other : T ) {
380- self . 0 += other;
381- assert ! ( !self . 0 . is_nan( ) , "Addition resulted in NaN" ) ;
380+ * self = * self + other;
382381 }
383382}
384383
@@ -425,8 +424,7 @@ impl<T: Float + SubAssign> SubAssign for NotNan<T> {
425424/// Panics if the provided value is NaN or the computation results in NaN
426425impl < T : Float + SubAssign > SubAssign < T > for NotNan < T > {
427426 fn sub_assign ( & mut self , other : T ) {
428- self . 0 -= other;
429- assert ! ( !self . 0 . is_nan( ) , "Subtraction resulted in NaN" ) ;
427+ * self = * self - other;
430428 }
431429}
432430
@@ -460,8 +458,7 @@ impl<T: Float + MulAssign> MulAssign for NotNan<T> {
460458/// Panics if the provided value is NaN.
461459impl < T : Float + MulAssign > MulAssign < T > for NotNan < T > {
462460 fn mul_assign ( & mut self , other : T ) {
463- self . 0 *= other;
464- assert ! ( !self . 0 . is_nan( ) , "Multiplication resulted in NaN" ) ;
461+ * self = * self * other;
465462 }
466463}
467464
@@ -507,8 +504,7 @@ impl<T: Float + DivAssign> DivAssign for NotNan<T> {
507504/// Panics if the provided value is NaN or the computation results in NaN
508505impl < T : Float + DivAssign > DivAssign < T > for NotNan < T > {
509506 fn div_assign ( & mut self , other : T ) {
510- self . 0 /= other;
511- assert ! ( !self . 0 . is_nan( ) , "Division resulted in NaN" ) ;
507+ * self = * self / other;
512508 }
513509}
514510
@@ -542,8 +538,7 @@ impl<T: Float + RemAssign> RemAssign for NotNan<T> {
542538/// Panics if the provided value is NaN or the computation results in NaN
543539impl < T : Float + RemAssign > RemAssign < T > for NotNan < T > {
544540 fn rem_assign ( & mut self , other : T ) {
545- self . 0 %= other;
546- assert ! ( !self . 0 . is_nan( ) , "Rem resulted in NaN" ) ;
541+ * self = * self % other;
547542 }
548543}
549544
0 commit comments