diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-04-03 14:15:10 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-04-19 19:53:54 +1000 |
| commit | b9bcddc5276c97f8d66f637ae84658b37fbb4957 (patch) | |
| tree | 3fc6b278d8811451f4684f9d50be29ba20cd3e89 /src/librustc_driver | |
| parent | 309301847479403298438d70ce5c3f332da896d4 (diff) | |
| download | rust-b9bcddc5276c97f8d66f637ae84658b37fbb4957.tar.gz rust-b9bcddc5276c97f8d66f637ae84658b37fbb4957.zip | |
Make option type descriptions non-optional.
Because all options now can take a value. This simplifies some code quite a bit.
Diffstat (limited to 'src/librustc_driver')
| -rw-r--r-- | src/librustc_driver/lib.rs | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 0e3199975f9..fff86ba8194 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -955,32 +955,17 @@ fn describe_codegen_flags() { fn print_flag_list<T>( cmdline_opt: &str, - flag_list: &[(&'static str, T, Option<&'static str>, &'static str)], + flag_list: &[(&'static str, T, &'static str, &'static str)], ) { - let max_len = flag_list - .iter() - .map(|&(name, _, opt_type_desc, _)| { - let extra_len = match opt_type_desc { - Some(..) => 4, - None => 0, - }; - name.chars().count() + extra_len - }) - .max() - .unwrap_or(0); + let max_len = flag_list.iter().map(|&(name, _, _, _)| name.chars().count()).max().unwrap_or(0); - for &(name, _, opt_type_desc, desc) in flag_list { - let (width, extra) = match opt_type_desc { - Some(..) => (max_len - 4, "=val"), - None => (max_len, ""), - }; + for &(name, _, _, desc) in flag_list { println!( - " {} {:>width$}{} -- {}", + " {} {:>width$}=val -- {}", cmdline_opt, name.replace("_", "-"), - extra, desc, - width = width + width = max_len ); } } |
