diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 5768539b2cd7..9f666ace76e9 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -655,22 +655,6 @@ pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config { } } -/// Returns the "short" subset of the stable rustc command line options. -pub fn short_optgroups() -> Vec { - rustc_short_optgroups().into_iter() - .filter(|g|g.is_stable()) - .map(|g|g.opt_group) - .collect() -} - -/// Returns all of the stable rustc command line options. -pub fn optgroups() -> Vec { - rustc_optgroups().into_iter() - .filter(|g|g.is_stable()) - .map(|g|g.opt_group) - .collect() -} - #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum OptionStability { Stable, Unstable } @@ -730,10 +714,10 @@ mod opt { pub fn flagopt_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optflagopt(a, b, c, d)) } } -/// Returns the "short" subset of the rustc command line options, -/// including metadata for each option, such as whether the option is -/// part of the stable long-term interface for rustc. -pub fn rustc_short_optgroups() -> Vec { +/// Returns all rustc command line options, including metadata for +/// each option, such as whether the option is part of the stable +/// long-term interface for rustc. +pub fn rustc_optgroups() -> Vec { vec![ opt::flag("h", "help", "Display this message"), opt::multi("", "cfg", "Configure the compilation environment", "SPEC"), @@ -774,15 +758,6 @@ pub fn rustc_short_optgroups() -> Vec { opt::multi("C", "codegen", "Set a codegen option", "OPT[=VALUE]"), opt::flag("V", "version", "Print version info and exit"), opt::flag("v", "verbose", "Use verbose output"), - ] -} - -/// Returns all rustc command line options, including metadata for -/// each option, such as whether the option is part of the stable -/// long-term interface for rustc. -pub fn rustc_optgroups() -> Vec { - let mut opts = rustc_short_optgroups(); - opts.push_all(&[ opt::multi("", "extern", "Specify where an external rust library is \ located", "NAME=PATH"), @@ -807,8 +782,7 @@ pub fn rustc_optgroups() -> Vec { `everybody_loops` (all function bodies replaced with `loop {}`).", "TYPE"), opt::opt_u("", "show-span", "Show spans for compiler debugging", "expr|pat|ty"), - ]); - opts + ] } // Convert strings provided as --cfg [cfgspec] into a crate_cfg diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index ac91a0098ea7..082407f3833b 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -497,29 +497,18 @@ pub fn version(binary: &str, matches: &getopts::Matches) { } } -fn usage(verbose: bool, include_unstable_options: bool) { - let groups = if verbose { - config::rustc_optgroups() - } else { - config::rustc_short_optgroups() - }; - let groups : Vec<_> = groups.into_iter() +fn usage(include_unstable_options: bool) { + let groups : Vec<_> = config::rustc_optgroups().into_iter() .filter(|x| include_unstable_options || x.is_stable()) .map(|x|x.opt_group) .collect(); let message = format!("Usage: rustc [OPTIONS] INPUT"); - let extra_help = if verbose { - "" - } else { - "\n --help -v Print the full set of options rustc accepts" - }; println!("{}\n\ Additional help: -C help Print codegen options -W help Print 'lint' options and default settings - -Z help Print internal options for debugging rustc{}\n", - getopts::usage(&message, &groups), - extra_help); + -Z help Print internal options for debugging rustc\n", + getopts::usage(&message, &groups)); } fn describe_lints(lint_store: &lint::LintStore, loaded_plugins: bool) { @@ -673,7 +662,7 @@ pub fn handle_options(mut args: Vec) -> Option { if args.is_empty() { // user did not write `-v` nor `-Z unstable-options`, so do not // include that extra information. - usage(false, false); + usage(false); return None; } @@ -709,7 +698,7 @@ pub fn handle_options(mut args: Vec) -> Option { let include_unstable_options = r.iter().any(|x| *x == "unstable-options"); if matches.opt_present("h") || matches.opt_present("help") { - usage(matches.opt_present("verbose"), include_unstable_options); + usage(include_unstable_options); return None; }