crater: hook into main.rs

This commit is contained in:
Matthias Krüger 2020-12-18 14:28:59 +01:00
parent 5353591b1b
commit 30d85942cf
2 changed files with 7 additions and 3 deletions

View File

@ -69,7 +69,7 @@ fn build_clippy() {
} }
// the main fn // the main fn
pub(crate) fn run() { pub fn run() {
let cargo_clippy_path: PathBuf = PathBuf::from("target/debug/cargo-clippy"); let cargo_clippy_path: PathBuf = PathBuf::from("target/debug/cargo-clippy");
let clippy_driver_path: PathBuf = PathBuf::from("target/debug/cargo-driver"); let clippy_driver_path: PathBuf = PathBuf::from("target/debug/cargo-driver");
@ -88,7 +88,7 @@ pub(crate) fn run() {
); );
// download and extract the crates, then run clippy on them and collect clippys warnings // download and extract the crates, then run clippy on them and collect clippys warnings
let clippy_lint_results: Vec<String> = krates let _clippy_lint_results: Vec<String> = krates
.into_iter() .into_iter()
.map(|krate| krate.download_and_extract()) .map(|krate| krate.download_and_extract())
.map(|krate| krate.run_clippy_lints()) .map(|krate| krate.run_clippy_lints())

View File

@ -1,7 +1,7 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]
use clap::{App, Arg, ArgMatches, SubCommand}; use clap::{App, Arg, ArgMatches, SubCommand};
use clippy_dev::{bless, fmt, new_lint, ra_setup, serve, stderr_length_check, update_lints}; use clippy_dev::{bless, crater, fmt, new_lint, ra_setup, serve, stderr_length_check, update_lints};
fn main() { fn main() {
let matches = get_clap_config(); let matches = get_clap_config();
@ -10,6 +10,9 @@ fn main() {
("bless", Some(matches)) => { ("bless", Some(matches)) => {
bless::bless(matches.is_present("ignore-timestamp")); bless::bless(matches.is_present("ignore-timestamp"));
}, },
("crater", Some(_)) => {
crater::run();
},
("fmt", Some(matches)) => { ("fmt", Some(matches)) => {
fmt::run(matches.is_present("check"), matches.is_present("verbose")); fmt::run(matches.is_present("check"), matches.is_present("verbose"));
}, },
@ -56,6 +59,7 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
.help("Include files updated before clippy was built"), .help("Include files updated before clippy was built"),
), ),
) )
.subcommand(SubCommand::with_name("crater").about("run clippy on a set of crates and check output"))
.subcommand( .subcommand(
SubCommand::with_name("fmt") SubCommand::with_name("fmt")
.about("Run rustfmt on all projects and tests") .about("Run rustfmt on all projects and tests")