@@ -116,7 +116,7 @@ impl Color {
116
116
Color { r, g, b, a }
117
117
}
118
118
119
- pub fn to_u32 ( & self , format : & PixelFormat ) -> u32 {
119
+ pub fn to_u32 ( self , format : & PixelFormat ) -> u32 {
120
120
unsafe { sys:: SDL_MapRGBA ( format. raw , self . r , self . g , self . b , self . a ) }
121
121
}
122
122
@@ -130,18 +130,18 @@ impl Color {
130
130
}
131
131
132
132
#[ inline]
133
- pub fn rgb ( & self ) -> ( u8 , u8 , u8 ) {
133
+ pub fn rgb ( self ) -> ( u8 , u8 , u8 ) {
134
134
( self . r , self . g , self . b )
135
135
}
136
136
137
137
#[ inline]
138
- pub fn rgba ( & self ) -> ( u8 , u8 , u8 , u8 ) {
138
+ pub fn rgba ( self ) -> ( u8 , u8 , u8 , u8 ) {
139
139
( self . r , self . g , self . b , self . a )
140
140
}
141
141
142
142
// Implemented manually and kept private, because reasons
143
143
#[ inline]
144
- fn raw ( & self ) -> sys:: SDL_Color {
144
+ fn raw ( self ) -> sys:: SDL_Color {
145
145
sys:: SDL_Color { r : self . r , g : self . g , b : self . b , a : self . a }
146
146
}
147
147
}
@@ -293,8 +293,8 @@ impl PixelFormatEnum {
293
293
294
294
/// Calculates the total byte size of an image buffer, given its pitch
295
295
/// and height.
296
- pub fn byte_size_from_pitch_and_height ( & self , pitch : usize , height : usize ) -> usize {
297
- match * self {
296
+ pub fn byte_size_from_pitch_and_height ( self , pitch : usize , height : usize ) -> usize {
297
+ match self {
298
298
PixelFormatEnum :: YV12 | PixelFormatEnum :: IYUV => {
299
299
// YUV is 4:2:0.
300
300
// `pitch` is the width of the Y component, and
@@ -306,9 +306,9 @@ impl PixelFormatEnum {
306
306
}
307
307
}
308
308
309
- #[ cfg_attr ( feature = "cargo-clippy" , allow( match_same_arms) ) ]
310
- pub fn byte_size_of_pixels ( & self , num_of_pixels : usize ) -> usize {
311
- match * self {
309
+ #[ allow( clippy :: match_same_arms) ]
310
+ pub fn byte_size_of_pixels ( self , num_of_pixels : usize ) -> usize {
311
+ match self {
312
312
PixelFormatEnum :: RGB332
313
313
=> num_of_pixels,
314
314
PixelFormatEnum :: RGB444 | PixelFormatEnum :: RGB555 |
@@ -340,13 +340,13 @@ impl PixelFormatEnum {
340
340
PixelFormatEnum :: Unknown | PixelFormatEnum :: Index1LSB |
341
341
PixelFormatEnum :: Index1MSB | PixelFormatEnum :: Index4LSB |
342
342
PixelFormatEnum :: Index4MSB
343
- => panic ! ( "not supported format: {:?}" , * self ) ,
343
+ => panic ! ( "not supported format: {:?}" , self ) ,
344
344
}
345
345
}
346
346
347
- #[ cfg_attr ( feature = "cargo-clippy" , allow( match_same_arms) ) ]
348
- pub fn byte_size_per_pixel ( & self ) -> usize {
349
- match * self {
347
+ #[ allow( clippy :: match_same_arms) ]
348
+ pub fn byte_size_per_pixel ( self ) -> usize {
349
+ match self {
350
350
PixelFormatEnum :: RGB332
351
351
=> 1 ,
352
352
PixelFormatEnum :: RGB444 | PixelFormatEnum :: RGB555 |
@@ -377,13 +377,13 @@ impl PixelFormatEnum {
377
377
PixelFormatEnum :: Unknown | PixelFormatEnum :: Index1LSB |
378
378
PixelFormatEnum :: Index1MSB | PixelFormatEnum :: Index4LSB |
379
379
PixelFormatEnum :: Index4MSB
380
- => panic ! ( "not supported format: {:?}" , * self ) ,
380
+ => panic ! ( "not supported format: {:?}" , self ) ,
381
381
}
382
382
}
383
383
384
- pub fn supports_alpha ( & self ) -> bool {
384
+ pub fn supports_alpha ( self ) -> bool {
385
385
use crate :: pixels:: PixelFormatEnum :: * ;
386
- match * self {
386
+ match self {
387
387
ARGB4444 | ARGB1555 | ARGB8888 | ARGB2101010 |
388
388
ABGR4444 | ABGR1555 | ABGR8888 |
389
389
BGRA4444 | BGRA5551 | BGRA8888 |
@@ -396,7 +396,7 @@ impl PixelFormatEnum {
396
396
impl From < PixelFormat > for PixelFormatEnum {
397
397
fn from ( pf : PixelFormat ) -> PixelFormatEnum {
398
398
unsafe {
399
- let ref sdl_pf = * pf. raw ;
399
+ let sdl_pf = * pf. raw ;
400
400
match PixelFormatEnum :: from_u64 ( sdl_pf. format as u64 ) {
401
401
Some ( pfe) => pfe,
402
402
None => panic ! ( "Unknown pixel format: {:?}" , sdl_pf. format)
0 commit comments