File tree Expand file tree Collapse file tree 4 files changed +13
-14
lines changed Expand file tree Collapse file tree 4 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 47
47
- uses : actions-rs/cargo@v1
48
48
with :
49
49
command : clippy
50
- args : -- -D warnings
50
+ args : --all -- -D warnings
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " dmi"
3
3
version = " 0.1.3"
4
- edition = " 2018 "
4
+ edition = " 2021 "
5
5
license = " MIT"
6
6
description = " DMI library written in Rust. Provides helpers to manipulate and produce DMI format files."
7
7
authors = [" Rohesie <rohesie@gmail.com>" ]
@@ -12,6 +12,6 @@ exclude = ["src/tests.rs", "tests/*"]
12
12
13
13
[dependencies ]
14
14
thiserror = " 1.0"
15
- image = " 0.23 "
15
+ image = { version = " 0.24 " , default-features = false , features = [ " png " ] }
16
16
deflate = " 1.0"
17
17
inflate = " 0.4"
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use image::imageops;
6
6
use image:: GenericImageView ;
7
7
use std:: collections:: HashMap ;
8
8
use std:: io:: prelude:: * ;
9
+ use std:: io:: Cursor ;
9
10
10
11
#[ derive( Clone , Default ) ]
11
12
pub struct Icon {
@@ -345,14 +346,14 @@ impl Icon {
345
346
imageops:: replace (
346
347
& mut new_png,
347
348
* image,
348
- self . width * ( index % max_index) ,
349
- self . height * ( index / max_index) ,
349
+ ( self . width * ( index % max_index) ) . into ( ) ,
350
+ ( self . height * ( index / max_index) ) . into ( ) ,
350
351
) ;
351
352
}
352
353
353
- let mut new_dmi = vec ! [ ] ;
354
- new_png. write_to ( & mut new_dmi , image:: ImageOutputFormat :: Png ) ?;
355
- let mut new_dmi = RawDmi :: load ( & new_dmi [ ..] ) ?;
354
+ let mut dmi_data = Cursor :: new ( vec ! [ ] ) ;
355
+ new_png. write_to ( & mut dmi_data , image:: ImageOutputFormat :: Png ) ?;
356
+ let mut new_dmi = RawDmi :: load ( & dmi_data . into_inner ( ) [ ..] ) ?;
356
357
357
358
let new_ztxt = ztxt:: create_ztxt_chunk ( signature. as_bytes ( ) ) ?;
358
359
Original file line number Diff line number Diff line change @@ -289,12 +289,10 @@ impl RawZtxtData {
289
289
pub fn decode ( & self ) -> Result < Vec < u8 > , error:: DmiError > {
290
290
match inflate:: inflate_bytes_zlib ( & self . compressed_text ) {
291
291
Ok ( decompressed_text) => Ok ( decompressed_text) ,
292
- Err ( text) => {
293
- return Err ( error:: DmiError :: Generic ( format ! (
294
- "Failed to read compressed text. Error: {}" ,
295
- text
296
- ) ) )
297
- }
292
+ Err ( text) => Err ( error:: DmiError :: Generic ( format ! (
293
+ "Failed to read compressed text. Error: {}" ,
294
+ text
295
+ ) ) ) ,
298
296
}
299
297
}
300
298
You can’t perform that action at this time.
0 commit comments