@@ -14,8 +14,14 @@ use std::{fs::write, path::PathBuf};
14
14
15
15
use serde:: { Deserialize , Serialize } ;
16
16
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
19
25
struct TomlCrate {
20
26
name : String ,
21
27
versions : Vec < String > ,
@@ -28,12 +34,6 @@ struct CrateSource {
28
34
version : String ,
29
35
}
30
36
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
-
37
37
// represents the extracted sourcecode of a crate
38
38
#[ derive( Debug ) ]
39
39
struct Crate {
@@ -70,14 +70,8 @@ impl CrateSource {
70
70
// unzip the tarball
71
71
let ungz_tar = flate2:: read:: GzDecoder :: new ( std:: fs:: File :: open ( & krate_file_path) . unwrap ( ) ) ;
72
72
// 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!" ) ;
81
75
}
82
76
// crate is extracted, return a new Krate object which contains the path to the extracted
83
77
// sources that clippy can check
@@ -132,7 +126,7 @@ impl Crate {
132
126
} )
133
127
. collect ( ) ;
134
128
135
- // sort messages alphabtically to avoid noise in the logs
129
+ // sort messages alphabetically to avoid noise in the logs
136
130
output. sort ( ) ;
137
131
output
138
132
}
0 commit comments