File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ impl BitMask {
6262 // versions (pre-ARMv7) don't have RBIT and need to emulate it
6363 // instead. Since we only have 1 bit set in each byte on ARM, we can
6464 // use swap_bytes (REV) + leading_zeroes instead.
65- if cfg ! ( target_arch = "arm" ) && BITMASK_STRIDE % 8 == 0 {
65+ if cfg ! ( target_arch = "arm" ) && BITMASK_STRIDE . is_multiple_of ( 8 ) {
6666 self . 0 . swap_bytes ( ) . leading_zeros ( ) as usize / BITMASK_STRIDE
6767 } else {
6868 self . 0 . trailing_zeros ( ) as usize / BITMASK_STRIDE
@@ -72,7 +72,7 @@ impl BitMask {
7272 /// Same as above but takes a `NonZeroBitMaskWord`.
7373 #[ inline]
7474 fn nonzero_trailing_zeros ( nonzero : NonZeroBitMaskWord ) -> usize {
75- if cfg ! ( target_arch = "arm" ) && BITMASK_STRIDE % 8 == 0 {
75+ if cfg ! ( target_arch = "arm" ) && BITMASK_STRIDE . is_multiple_of ( 8 ) {
7676 // SAFETY: A byte-swapped non-zero value is still non-zero.
7777 let swapped = unsafe { NonZeroBitMaskWord :: new_unchecked ( nonzero. get ( ) . swap_bytes ( ) ) } ;
7878 swapped. leading_zeros ( ) as usize / BITMASK_STRIDE
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ where
218218 // and could hypothetically handle differences between stride and size, but this memory
219219 // has already been allocated so we know it can't overflow and currently rust does not
220220 // support such types. So we can do better by skipping some checks and avoid an unwrap.
221- assert ! ( mem:: size_of:: <T >( ) % mem:: align_of:: <T >( ) == 0 ) ;
221+ assert ! ( mem:: size_of:: <T >( ) . is_multiple_of ( mem:: align_of:: <T >( ) ) ) ;
222222
223223 unsafe {
224224 let align = mem:: align_of :: < T > ( ) ;
@@ -354,7 +354,7 @@ where
354354
355355 fn shrink ( & mut self , cap : usize ) -> Result < ( ) , AllocError > {
356356 // See current_memory() why this assert is here
357- assert ! ( mem:: size_of:: <T >( ) % mem:: align_of:: <T >( ) == 0 ) ;
357+ assert ! ( mem:: size_of:: <T >( ) . is_multiple_of ( mem:: align_of:: <T >( ) ) ) ;
358358 assert ! (
359359 cap <= self . capacity( ) ,
360360 "Tried to shrink to a larger capacity"
You can’t perform that action at this time.
0 commit comments