@@ -356,8 +356,7 @@ impl<T: Float + AddAssign> AddAssign for NotNan<T> {
356
356
/// Panics if the provided value is NaN.
357
357
impl < T : Float + AddAssign > AddAssign < T > for NotNan < T > {
358
358
fn add_assign ( & mut self , other : T ) {
359
- self . 0 += other;
360
- assert ! ( !self . 0 . is_nan( ) , "Addition resulted in NaN" ) ;
359
+ * self = * self + other;
361
360
}
362
361
}
363
362
@@ -404,8 +403,7 @@ impl<T: Float + SubAssign> SubAssign for NotNan<T> {
404
403
/// Panics if the provided value is NaN or the computation results in NaN
405
404
impl < T : Float + SubAssign > SubAssign < T > for NotNan < T > {
406
405
fn sub_assign ( & mut self , other : T ) {
407
- self . 0 -= other;
408
- assert ! ( !self . 0 . is_nan( ) , "Subtraction resulted in NaN" ) ;
406
+ * self = * self - other;
409
407
}
410
408
}
411
409
@@ -439,8 +437,7 @@ impl<T: Float + MulAssign> MulAssign for NotNan<T> {
439
437
/// Panics if the provided value is NaN.
440
438
impl < T : Float + MulAssign > MulAssign < T > for NotNan < T > {
441
439
fn mul_assign ( & mut self , other : T ) {
442
- self . 0 *= other;
443
- assert ! ( !self . 0 . is_nan( ) , "Multiplication resulted in NaN" ) ;
440
+ * self = * self * other;
444
441
}
445
442
}
446
443
@@ -486,8 +483,7 @@ impl<T: Float + DivAssign> DivAssign for NotNan<T> {
486
483
/// Panics if the provided value is NaN or the computation results in NaN
487
484
impl < T : Float + DivAssign > DivAssign < T > for NotNan < T > {
488
485
fn div_assign ( & mut self , other : T ) {
489
- self . 0 /= other;
490
- assert ! ( !self . 0 . is_nan( ) , "Division resulted in NaN" ) ;
486
+ * self = * self / other;
491
487
}
492
488
}
493
489
@@ -521,8 +517,7 @@ impl<T: Float + RemAssign> RemAssign for NotNan<T> {
521
517
/// Panics if the provided value is NaN or the computation results in NaN
522
518
impl < T : Float + RemAssign > RemAssign < T > for NotNan < T > {
523
519
fn rem_assign ( & mut self , other : T ) {
524
- self . 0 %= other;
525
- assert ! ( !self . 0 . is_nan( ) , "Rem resulted in NaN" ) ;
520
+ * self = * self % other;
526
521
}
527
522
}
528
523
0 commit comments