@@ -192,8 +192,10 @@ fn build_clippy() {
192
192
}
193
193
194
194
// get a list of CrateSources we want to check from a "lintcheck_crates.toml" file.
195
- fn read_crates ( toml_path : Option < & str > ) -> Vec < CrateSource > {
195
+ fn read_crates ( toml_path : Option < & str > ) -> ( String , Vec < CrateSource > ) {
196
196
let toml_path = PathBuf :: from ( toml_path. unwrap_or ( "clippy_dev/lintcheck_crates.toml" ) ) ;
197
+ // save it so that we can use the name of the sources.toml as name for the logfile later.
198
+ let toml_filename = toml_path. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
197
199
let toml_content: String =
198
200
std:: fs:: read_to_string ( & toml_path) . unwrap_or_else ( |_| panic ! ( "Failed to read {}" , toml_path. display( ) ) ) ;
199
201
let crate_list: CrateList =
@@ -237,7 +239,7 @@ fn read_crates(toml_path: Option<&str>) -> Vec<CrateSource> {
237
239
unreachable ! ( "Failed to translate TomlCrate into CrateSource!" ) ;
238
240
}
239
241
} ) ;
240
- crate_sources
242
+ ( toml_filename , crate_sources)
241
243
}
242
244
243
245
// extract interesting data from a json lint message
@@ -288,7 +290,7 @@ pub fn run(clap_config: &ArgMatches) {
288
290
// download and extract the crates, then run clippy on them and collect clippys warnings
289
291
// flatten into one big list of warnings
290
292
291
- let crates = read_crates ( clap_config. value_of ( "crates-toml" ) ) ;
293
+ let ( filename , crates) = read_crates ( clap_config. value_of ( "crates-toml" ) ) ;
292
294
293
295
let clippy_warnings: Vec < ClippyWarning > = if let Some ( only_one_crate) = clap_config. value_of ( "only" ) {
294
296
// if we don't have the specified crate in the .toml, throw an error
@@ -351,5 +353,6 @@ pub fn run(clap_config: &ArgMatches) {
351
353
// save the text into lintcheck-logs/logs.txt
352
354
let mut text = clippy_ver; // clippy version number on top
353
355
text. push_str ( & format ! ( "\n {}" , all_msgs. join( "" ) ) ) ;
354
- write ( "lintcheck-logs/logs.txt" , text) . unwrap ( ) ;
356
+ let file = format ! ( "lintcheck-logs/{}_logs.txt" , filename) ;
357
+ write ( file, text) . unwrap ( ) ;
355
358
}
0 commit comments