From 49392fce53f938fda5b34673c98001ac7fea5d0f Mon Sep 17 00:00:00 2001 From: topecongiro Date: Thu, 2 Nov 2017 07:13:14 +0900 Subject: [PATCH] Avoid panicking when no arg is given to clippy_driver --- src/driver.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/driver.rs b/src/driver.rs index df0ff4c3f1f..8e4114bac1b 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -163,6 +163,9 @@ pub fn main() { // Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument. // We're invoking the compiler programatically, so we ignore this/ let mut orig_args: Vec = env::args().collect(); + if orig_args.len() <= 1 { + std::process::exit(1); + } if orig_args[1] == "rustc" { // we still want to be able to invoke it normally though orig_args.remove(1);