Add cargo dev lint to manually run clippy on a file

I found the manual run command really useful, this makes it a bit easier
to type
This commit is contained in:
Alex Macleod
2021-11-02 13:21:27 +00:00
parent 18cc4e74f8
commit b5bae09184
4 changed files with 36 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
use clippy_dev::{bless, fmt, new_lint, serve, setup, update_lints};
use clippy_dev::{bless, fmt, lint, new_lint, serve, setup, update_lints};
fn main() {
let matches = get_clap_config();
@@ -55,6 +55,10 @@ fn main() {
let lint = matches.value_of("lint");
serve::run(port, lint);
},
("lint", Some(matches)) => {
let filename = matches.value_of("filename").unwrap();
lint::run(filename);
},
_ => {},
}
}
@@ -219,5 +223,14 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
)
.arg(Arg::with_name("lint").help("Which lint's page to load initially (optional)")),
)
.subcommand(
SubCommand::with_name("lint")
.about("Manually run clippy on a file")
.arg(
Arg::with_name("filename")
.required(true)
.help("The path to a file to lint"),
),
)
.get_matches()
}