Skip to content

Commit

Permalink
Auto merge of #4810 - Areredify:4716-fix, r=flip1995
Browse files Browse the repository at this point in the history
clippy-driver display help on empty command line arguments

changelog: fixes #4716, now displaying help if clippy-driver is run with no arguments.
  • Loading branch information
bors committed Nov 13, 2019
2 parents 320b94d + 227dc44 commit 0574d66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ pub fn main() {

// Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument.
// We're invoking the compiler programmatically, so we ignore this/
let wrapper_mode = Path::new(&orig_args[1]).file_stem() == Some("rustc".as_ref());
let wrapper_mode = orig_args.get(1).map(Path::new).and_then(Path::file_stem) == Some("rustc".as_ref());

if wrapper_mode {
// we still want to be able to invoke it normally though
orig_args.remove(1);
}

if !wrapper_mode && std::env::args().any(|a| a == "--help" || a == "-h") {
if !wrapper_mode && (orig_args.iter().any(|a| a == "--help" || a == "-h") || orig_args.len() == 1) {
display_help();
exit(0);
}
Expand Down

0 comments on commit 0574d66

Please sign in to comment.