@@ -106,7 +106,7 @@ impl CrateSource {
106
106
}
107
107
108
108
impl Crate {
109
- fn run_clippy_lints ( & self , cargo_clippy_path : & PathBuf ) -> Vec < String > {
109
+ fn run_clippy_lints ( & self , cargo_clippy_path : & PathBuf ) -> Vec < ClippyWarning > {
110
110
println ! ( "Linting {} {}..." , & self . name, & self . version) ;
111
111
let cargo_clippy_path = std:: fs:: canonicalize ( cargo_clippy_path) . unwrap ( ) ;
112
112
@@ -136,11 +136,7 @@ impl Crate {
136
136
. filter ( |line| line. contains ( "clippy::" ) )
137
137
. map ( |json_msg| parse_json_message ( json_msg, & self ) )
138
138
. collect ( ) ;
139
-
140
- let mut output: Vec < String > = warnings. iter ( ) . map ( |warning| warning. to_string ( ) ) . collect ( ) ;
141
- // sort messages alphabetically to avoid noise in the logs
142
- output. sort ( ) ;
143
- output
139
+ warnings
144
140
}
145
141
}
146
142
@@ -219,17 +215,18 @@ pub fn run() {
219
215
) ;
220
216
221
217
// download and extract the crates, then run clippy on them and collect clippys warnings
218
+ // flatten into one big list of warnings
222
219
223
- let clippy_lint_results : Vec < Vec < String > > = read_crates ( )
220
+ let clippy_warnings : Vec < ClippyWarning > = read_crates ( )
224
221
. into_iter ( )
225
222
. map ( |krate| krate. download_and_extract ( ) )
226
223
. map ( |krate| krate. run_clippy_lints ( & cargo_clippy_path) )
224
+ . flatten ( )
227
225
. collect ( ) ;
228
226
229
- let mut all_warnings: Vec < String > = clippy_lint_results. into_iter ( ) . flatten ( ) . collect ( ) ;
230
- all_warnings. sort ( ) ;
227
+ let all_msgs: Vec < String > = clippy_warnings. iter ( ) . map ( |warning| warning. to_string ( ) ) . collect ( ) ;
231
228
232
229
// save the text into mini-crater/logs.txt
233
- let text = all_warnings . join ( "" ) ;
230
+ let text = all_msgs . join ( "" ) ;
234
231
write ( "mini-crater/logs.txt" , text) . unwrap ( ) ;
235
232
}
0 commit comments