diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2018-07-31 10:02:32 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2018-07-31 10:02:32 +1200 |
| commit | d43874113e6b9fc604dbacfd202d2a913a11fef4 (patch) | |
| tree | 707e36aa8512232136f5a457d6cc7548b34c5d6d /src | |
| parent | 3c20d8a9e626eda5ecc283542735e708f3a84959 (diff) | |
Warn the user if using an unstable option without `--unstable-options`
Fixes #2796
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/main.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index 049749f8f52..05752055e06 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -473,6 +473,25 @@ impl GetOptsOptions { if let Some(ref file_lines) = matches.opt_str("file-lines") { options.file_lines = file_lines.parse().map_err(err_msg)?; } + } else { + let mut unstable_options = vec![]; + if matches.opt_present("skip-children") { + unstable_options.push("`--skip-children`"); + } + if matches.opt_present("error-on-unformatted") { + unstable_options.push("`--error-on-unformatted`"); + } + if matches.opt_present("file-lines") { + unstable_options.push("`--file-lines`"); + } + if !unstable_options.is_empty() { + let s = if unstable_options.len() == 1 { "" } else { "s" }; + return Err(format_err!( + "Unstable option{} ({}) used without `--unstable-features`", + s, + unstable_options.join(", "), + )); + } } options.config_path = matches.opt_str("config-path").map(PathBuf::from); |
