@@ -80,7 +80,7 @@ impl<R: Read> DxtDecoder<R> {
8080 height : u32 ,
8181 variant : DxtVariant ,
8282 ) -> Result < DxtDecoder < R > , ImageError > {
83- if width % 4 != 0 || height % 4 != 0 {
83+ if ! width. is_multiple_of ( 4 ) || ! height. is_multiple_of ( 4 ) {
8484 // TODO: this is actually a bit of a weird case. We could return `DecodingError` but
8585 // it's not really the format that is wrong However, the encoder should surely return
8686 // `EncodingError` so it would be the logical choice for symmetry.
@@ -289,7 +289,7 @@ fn decode_dxt1_block(source: &[u8], dest: &mut [u8]) {
289289/// Decode a row of DXT1 data to four rows of RGB data.
290290/// `source.len()` should be a multiple of 8, otherwise this panics.
291291fn decode_dxt1_row ( source : & [ u8 ] , dest : & mut [ u8 ] ) {
292- assert ! ( source. len( ) % 8 == 0 ) ;
292+ assert ! ( source. len( ) . is_multiple_of ( 8 ) ) ;
293293 let block_count = source. len ( ) / 8 ;
294294 assert ! ( dest. len( ) >= block_count * 48 ) ;
295295
@@ -310,7 +310,7 @@ fn decode_dxt1_row(source: &[u8], dest: &mut [u8]) {
310310/// Decode a row of DXT3 data to four rows of RGBA data.
311311/// `source.len()` should be a multiple of 16, otherwise this panics.
312312fn decode_dxt3_row ( source : & [ u8 ] , dest : & mut [ u8 ] ) {
313- assert ! ( source. len( ) % 16 == 0 ) ;
313+ assert ! ( source. len( ) . is_multiple_of ( 16 ) ) ;
314314 let block_count = source. len ( ) / 16 ;
315315 assert ! ( dest. len( ) >= block_count * 64 ) ;
316316
@@ -331,7 +331,7 @@ fn decode_dxt3_row(source: &[u8], dest: &mut [u8]) {
331331/// Decode a row of DXT5 data to four rows of RGBA data.
332332/// `source.len()` should be a multiple of 16, otherwise this panics.
333333fn decode_dxt5_row ( source : & [ u8 ] , dest : & mut [ u8 ] ) {
334- assert ! ( source. len( ) % 16 == 0 ) ;
334+ assert ! ( source. len( ) . is_multiple_of ( 16 ) ) ;
335335 let block_count = source. len ( ) / 16 ;
336336 assert ! ( dest. len( ) >= block_count * 64 ) ;
337337
0 commit comments