mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
cliparser: remove ParseOptions::ignore_errors
Summary: It's not actually used anywhere. Reviewed By: sfilipco Differential Revision: D16715452 fbshipit-source-id: ea3e1411b38220f7555de11fa71da258c1c9d0d7
This commit is contained in:
parent
f49868e6e7
commit
d2e169b097
@ -296,7 +296,6 @@ pub trait StructFlags {
|
||||
|
||||
pub struct ParseOptions {
|
||||
ignore_prefix: bool,
|
||||
ignore_errors: bool,
|
||||
early_parse: bool,
|
||||
keep_sep: bool,
|
||||
error_on_unknown_opts: bool,
|
||||
@ -308,7 +307,6 @@ impl ParseOptions {
|
||||
pub fn new() -> Self {
|
||||
ParseOptions {
|
||||
ignore_prefix: false,
|
||||
ignore_errors: false,
|
||||
early_parse: false,
|
||||
keep_sep: false,
|
||||
error_on_unknown_opts: false,
|
||||
@ -322,11 +320,6 @@ impl ParseOptions {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn ignore_errors(mut self, ignore_errors: bool) -> Self {
|
||||
self.ignore_errors = ignore_errors;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn early_parse(mut self, early_parse: bool) -> Self {
|
||||
self.early_parse = early_parse;
|
||||
self
|
||||
@ -485,8 +478,10 @@ impl Parser {
|
||||
opts: &mut HashMap<String, Value>,
|
||||
) -> Result<(), ParseError> {
|
||||
let arg = iter.next().unwrap().1;
|
||||
|
||||
debug_assert!(arg.starts_with("--"));
|
||||
let arg = &arg[2..];
|
||||
|
||||
let (arg, positive_flag) = if arg.starts_with("no-") {
|
||||
(&arg[3..], false)
|
||||
} else {
|
||||
@ -1209,23 +1204,6 @@ mod tests {
|
||||
assert_eq!(configs.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_errors_match() {
|
||||
let parser = ParseOptions::new()
|
||||
.ignore_prefix(true)
|
||||
.flags(flags())
|
||||
.ignore_errors(true)
|
||||
.into_parser();
|
||||
|
||||
let args = vec!["--shallow", "--config", "section.key=val"];
|
||||
|
||||
let result = parser.parse_args(&args).unwrap();
|
||||
|
||||
let configs: Vec<String> = result.pick("config");
|
||||
|
||||
assert_eq!(configs, vec!["section.key=val"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_aliased_option() {
|
||||
let parser = ParseOptions::new()
|
||||
|
Loading…
Reference in New Issue
Block a user