Skip to content

Commit 4e91012

Browse files
Fix new clippy warnings (#118)
1 parent d4af583 commit 4e91012

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎benches/encode.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where
9595
let mut output: Vec<u8> = Vec::with_capacity(image.size.pixels() as usize * 16);
9696

9797
b.iter(|| {
98-
output.truncate(0);
98+
output.clear();
9999

100100
let image = black_box(image);
101101

@@ -334,7 +334,7 @@ pub fn generate_mipmaps(c: &mut Criterion) {
334334
let mut output: Vec<u8> = Vec::with_capacity(len);
335335

336336
b.iter(|| {
337-
output.truncate(0);
337+
output.clear();
338338

339339
let image = black_box(image);
340340

‎src/header.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,10 +1246,8 @@ impl Dx9Header {
12461246
DxgiFormat::BC2_UNORM
12471247
} else if *four_cc == FourCC::DXT4 {
12481248
DxgiFormat::BC3_UNORM
1249-
} else if let Some(dxgi) = four_cc_to_dxgi(*four_cc) {
1250-
dxgi
12511249
} else {
1252-
return None;
1250+
four_cc_to_dxgi(*four_cc)?
12531251
}
12541252
}
12551253
Dx9PixelFormat::Mask(mask_pixel_format) => masked_to_dxgi(mask_pixel_format)?,

‎tests/layout.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn parse_data_layout_of_all_dds_files() {
3434

3535
let data_len = file_len - get_header_byte_len(&header);
3636
let expected_len = info.layout.data_len();
37-
assert_eq!(data_len, expected_len, "File: {:?}", &dds_path);
37+
assert_eq!(data_len, expected_len, "File: {:?}", dds_path);
3838
}
3939
}
4040

‎tests/pixel.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ fn from_header() {
1717
let from_format = PixelInfo::from(format);
1818
let from_header = PixelInfo::from_header(&header).ok();
1919

20-
assert_eq!(Some(from_format), from_header, "File: {:?}", &dds_path);
20+
assert_eq!(Some(from_format), from_header, "File: {:?}", dds_path);
2121
}
2222
}

0 commit comments

Comments
 (0)