mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 09:53:43 +01:00
Merge pull request #521 from jonathandturner/remove_bind_by_move
Remove bind_by_move_pattern_guards nightly feature
This commit is contained in:
commit
fcc41af899
@ -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(
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user