File tree Expand file tree Collapse file tree 5 files changed +11
-18
lines changed Expand file tree Collapse file tree 5 files changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ use crate::{
2020fn main ( ) -> ExitCode {
2121 let mut args = Arguments :: from_env ( ) ;
2222
23- if let Err ( e) =
24- ThumbnailerCommand :: try_from ( & mut args) . and_then ( |cmd| bign_handheld_thumbnailer ( cmd) )
25- {
23+ if let Err ( e) = ThumbnailerCommand :: try_from ( & mut args) . and_then ( bign_handheld_thumbnailer) {
2624 eprintln ! ( "{e}" ) ;
2725 return ExitCode :: FAILURE ;
2826 }
Original file line number Diff line number Diff line change @@ -18,10 +18,7 @@ impl CCIPartition {
1818 let length = u32:: from_le_bytes ( partition_bytes[ 4 ..] . try_into ( ) . unwrap ( ) ) ; //in media units
1919 let length = length * MEDIA_UNIT_SIZE ;
2020
21- CCIPartition {
22- offset,
23- length,
24- }
21+ CCIPartition { offset, length }
2522 }
2623}
2724
@@ -35,8 +32,11 @@ impl SMDHIcon {
3532 f. seek ( SeekFrom :: Start ( CCI_HEADER_MAGIC_OFFSET ) ) ?;
3633 let mut cci_magic = [ 0u8 ; 4 ] ;
3734 f. read_exact ( & mut cci_magic) ?;
38- if CCI_MAGIC_STR . as_bytes ( ) != & cci_magic {
39- return Err ( N3DSParsingError :: FileMagicNotFound ( CCI_MAGIC_STR , cci_magic) ) ;
35+ if CCI_MAGIC_STR . as_bytes ( ) != cci_magic {
36+ return Err ( N3DSParsingError :: FileMagicNotFound (
37+ CCI_MAGIC_STR ,
38+ cci_magic,
39+ ) ) ;
4040 }
4141 f. seek ( SeekFrom :: Start ( CCI_HEADER_PARTITION_TABLE_OFFSET ) ) ?;
4242 let mut partition_table = [ 0u8 ; CCI_HEADER_PARTITION_TABLE_SIZE ] ;
Original file line number Diff line number Diff line change @@ -257,9 +257,8 @@ impl SMDHIcon {
257257 + ticket_size_with_padding
258258 + tmd_size_with_padding;
259259
260- Self :: from_cia_tmd ( f, offset_content) . or_else ( |error | {
260+ Self :: from_cia_tmd ( f, offset_content) . inspect_err ( |_ | {
261261 eprintln ! ( "Failed to parse SMDH from CIA's CXI" ) ;
262- Err ( error. into ( ) )
263262 } )
264263 }
265264
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl SMDHIcon {
5252 f. seek ( SeekFrom :: Start ( cxi_start_pos + CXI_HEADER_MAGIC_OFFSET ) ) ?;
5353 let mut cxi_magic = [ 0u8 ; 4 ] ;
5454 f. read_exact ( & mut cxi_magic) ?;
55- if CXI_MAGIC_STR . as_bytes ( ) != & cxi_magic {
55+ if CXI_MAGIC_STR . as_bytes ( ) != cxi_magic {
5656 return Err ( N3DSParsingError :: FileMagicNotFound (
5757 CXI_MAGIC_STR ,
5858 cxi_magic,
Original file line number Diff line number Diff line change @@ -3,9 +3,7 @@ pub struct Bgr555(pub u16);
33
44impl From < [ u8 ; 2 ] > for Bgr555 {
55 fn from ( value : [ u8 ; 2 ] ) -> Self {
6- Self {
7- 0 : u16:: from_le_bytes ( value) ,
8- }
6+ Self ( u16:: from_le_bytes ( value) )
97 }
108}
119
@@ -14,9 +12,7 @@ pub struct Rgb565(pub u16);
1412
1513impl From < [ u8 ; 2 ] > for Rgb565 {
1614 fn from ( value : [ u8 ; 2 ] ) -> Self {
17- Self {
18- 0 : u16:: from_le_bytes ( value) ,
19- }
15+ Self ( u16:: from_le_bytes ( value) )
2016 }
2117}
2218
You can’t perform that action at this time.
0 commit comments