From: Yuki Okushi Date: Tue, 12 Nov 2019 07:36:08 +0000 (+0900) Subject: Rollup merge of #66263 - guanqun:make-error-explicit, r=alexcrichton X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=896484c71fa6fb9e0b9ed61795e21cc6a13ba801;hp=7596d34ea13b9401635fb159af9c1fd8df5adc78;p=rust.git Rollup merge of #66263 - guanqun:make-error-explicit, r=alexcrichton make the error message more readable When I type it wrong e.g. `--stage --bless`, missing a number here, this change would make it more explicit what's going wrong here. --- diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index d9580b59815..7b49cc0a929 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -448,12 +448,12 @@ pub fn parse(args: &[String]) -> Flags { Flags { verbose: matches.opt_count("verbose"), - stage: matches.opt_str("stage").map(|j| j.parse().unwrap()), + stage: matches.opt_str("stage").map(|j| j.parse().expect("`stage` should be a number")), dry_run: matches.opt_present("dry-run"), on_fail: matches.opt_str("on-fail"), rustc_error_format: matches.opt_str("error-format"), keep_stage: matches.opt_strs("keep-stage") - .into_iter().map(|j| j.parse().unwrap()) + .into_iter().map(|j| j.parse().expect("`keep-stage` should be a number")) .collect(), host: split(&matches.opt_strs("host")) .into_iter() @@ -464,7 +464,7 @@ pub fn parse(args: &[String]) -> Flags { .map(|x| INTERNER.intern_string(x)) .collect::>(), config: cfg_file, - jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()), + jobs: matches.opt_str("jobs").map(|j| j.parse().expect("`jobs` should be a number")), cmd, incremental: matches.opt_present("incremental"), exclude: split(&matches.opt_strs("exclude"))