File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,7 @@ macro_rules! impl_common {
115
115
fn add( self , rhs: Self ) -> Self :: Output {
116
116
let ( lo, carry) = self . lo. overflowing_add( rhs. lo) ;
117
117
let ( hi, of) = Int :: carrying_add( self . hi, rhs. hi, carry) ;
118
-
119
- #[ cfg( debug_assertions) ]
120
- if of {
121
- panic!( "attempt to add with overflow" )
122
- }
123
-
118
+ debug_assert!( !of, "attempt to add with overflow" ) ;
124
119
Self { lo, hi }
125
120
}
126
121
}
@@ -131,12 +126,7 @@ macro_rules! impl_common {
131
126
fn sub( self , rhs: Self ) -> Self :: Output {
132
127
let ( lo, borrow) = self . lo. overflowing_sub( rhs. lo) ;
133
128
let ( hi, of) = Int :: borrowing_sub( self . hi, rhs. hi, borrow) ;
134
-
135
- #[ cfg( debug_assertions) ]
136
- if of {
137
- panic!( "attempt to subtract with overflow" )
138
- }
139
-
129
+ debug_assert!( !of, "attempt to subtract with overflow" ) ;
140
130
Self { lo, hi }
141
131
}
142
132
}
You can’t perform that action at this time.
0 commit comments