Merge pull request #521 from jonathandturner/remove_bind_by_move

Remove bind_by_move_pattern_guards nightly feature
This commit is contained in:
Jonathan Turner 2019-08-29 15:33:55 +12:00 committed by GitHub
commit fcc41af899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 19 deletions

View File

@ -427,7 +427,7 @@ pub fn parse_string_as_value(
name_span: Span,
) -> Result<Tagged<Value>, ShellError> {
match extension {
Some(x) if x == "csv" => {
Some(ref x) if x == "csv" => {
crate::commands::from_csv::from_csv_string_to_value(contents, false, contents_tag)
.map_err(move |_| {
ShellError::labeled_error(
@ -437,7 +437,7 @@ pub fn parse_string_as_value(
)
})
}
Some(x) if x == "toml" => {
Some(ref x) if x == "toml" => {
crate::commands::from_toml::from_toml_string_to_value(contents, contents_tag).map_err(
move |_| {
ShellError::labeled_error(
@ -448,7 +448,7 @@ pub fn parse_string_as_value(
},
)
}
Some(x) if x == "json" => {
Some(ref x) if x == "json" => {
crate::commands::from_json::from_json_string_to_value(contents, contents_tag).map_err(
move |_| {
ShellError::labeled_error(
@ -459,21 +459,21 @@ pub fn parse_string_as_value(
},
)
}
Some(x) if x == "ini" => crate::commands::from_ini::from_ini_string_to_value(
Some(ref x) if x == "ini" => crate::commands::from_ini::from_ini_string_to_value(
contents,
contents_tag,
)
.map_err(move |_| {
ShellError::labeled_error("Could not open as INI", "could not open as INI", name_span)
}),
Some(x) if x == "xml" => crate::commands::from_xml::from_xml_string_to_value(
Some(ref x) if x == "xml" => crate::commands::from_xml::from_xml_string_to_value(
contents,
contents_tag,
)
.map_err(move |_| {
ShellError::labeled_error("Could not open as XML", "could not open as XML", name_span)
}),
Some(x) if x == "yml" => {
Some(ref x) if x == "yml" => {
crate::commands::from_yaml::from_yaml_string_to_value(contents, contents_tag).map_err(
move |_| {
ShellError::labeled_error(
@ -484,7 +484,7 @@ pub fn parse_string_as_value(
},
)
}
Some(x) if x == "yaml" => {
Some(ref x) if x == "yaml" => {
crate::commands::from_yaml::from_yaml_string_to_value(contents, contents_tag).map_err(
move |_| {
ShellError::labeled_error(
@ -506,7 +506,7 @@ pub fn parse_binary_as_value(
name_span: Span,
) -> Result<Tagged<Value>, ShellError> {
match extension {
Some(x) if x == "bson" => {
Some(ref x) if x == "bson" => {
crate::commands::from_bson::from_bson_bytes_to_value(contents, contents_tag).map_err(
move |_| {
ShellError::labeled_error(

View File

@ -37,7 +37,7 @@ pub fn skip_while(
let result = condition.invoke(&item);
let return_value = match result {
Ok(v) if v.is_true() => true,
Ok(ref v) if v.is_true() => true,
_ => false,
};

View File

@ -1,7 +1,6 @@
#![feature(crate_visibility_modifier)]
#![feature(in_band_lifetimes)]
#![feature(generators)]
#![feature(bind_by_move_pattern_guards)]
#![feature(specialization)]
#![feature(proc_macro_hygiene)]

View File

@ -672,9 +672,10 @@ crate fn reject_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> T
let descs = obj.data_descriptors();
for desc in descs {
match desc {
x if fields.iter().any(|field| *field == x) => continue,
_ => out.insert(desc.clone(), obj.get_data(&desc).borrow().clone()),
if fields.iter().any(|field| *field == desc) {
continue;
} else {
out.insert(desc.clone(), obj.get_data(&desc).borrow().clone())
}
}

View File

@ -177,16 +177,18 @@ fn parse_command_tail(
trace!("Constructed positional={:?} named={:?}", positional, named);
let positional = match positional {
positional if positional.len() == 0 => None,
positional => Some(positional),
let positional = if positional.len() == 0 {
None
} else {
Some(positional)
};
// TODO: Error if extra unconsumed positional arguments
let named = match named {
named if named.named.is_empty() => None,
named => Some(named),
let named = if named.named.is_empty() {
None
} else {
Some(named)
};
trace!("Normalized positional={:?} named={:?}", positional, named);