@@ -14,8 +14,14 @@ use std::{fs::write, path::PathBuf};
1414
1515use serde:: { Deserialize , Serialize } ;
1616
17- // crate data we stored in the toml, can have multiple versions.
18- // if so, one TomlKrate maps to several KrateSources
17+ // use this to store the crates when interacting with the crates.toml file
18+ #[ derive( Debug , Serialize , Deserialize ) ]
19+ struct CrateList {
20+ crates : HashMap < String , Vec < String > > ,
21+ }
22+
23+ // crate data we stored in the toml, can have multiple versions per crate
24+ // A single TomlCrate is laster mapped to several CrateSources in that case
1925struct TomlCrate {
2026 name : String ,
2127 versions : Vec < String > ,
@@ -28,12 +34,6 @@ struct CrateSource {
2834 version : String ,
2935}
3036
31- // use this to store the crates when interacting with the crates.toml file
32- #[ derive( Debug , Serialize , Deserialize ) ]
33- struct CrateList {
34- crates : HashMap < String , Vec < String > > ,
35- }
36-
3737// represents the extracted sourcecode of a crate
3838#[ derive( Debug ) ]
3939struct Crate {
@@ -70,14 +70,8 @@ impl CrateSource {
7070 // unzip the tarball
7171 let ungz_tar = flate2:: read:: GzDecoder :: new ( std:: fs:: File :: open ( & krate_file_path) . unwrap ( ) ) ;
7272 // extract the tar archive
73- let mut archiv = tar:: Archive :: new ( ungz_tar) ;
74- archiv. unpack ( & extract_dir) . expect ( "Failed to extract!" ) ;
75-
76- // unzip the tarball
77- let ungz_tar = flate2:: read:: GzDecoder :: new ( std:: fs:: File :: open ( & krate_file_path) . unwrap ( ) ) ;
78- // extract the tar archive
79- let mut archiv = tar:: Archive :: new ( ungz_tar) ;
80- archiv. unpack ( & extract_dir) . expect ( "Failed to extract!" ) ;
73+ let mut archive = tar:: Archive :: new ( ungz_tar) ;
74+ archive. unpack ( & extract_dir) . expect ( "Failed to extract!" ) ;
8175 }
8276 // crate is extracted, return a new Krate object which contains the path to the extracted
8377 // sources that clippy can check
@@ -132,7 +126,7 @@ impl Crate {
132126 } )
133127 . collect ( ) ;
134128
135- // sort messages alphabtically to avoid noise in the logs
129+ // sort messages alphabetically to avoid noise in the logs
136130 output. sort ( ) ;
137131 output
138132 }
0 commit comments