diff --git a/src/commands/open.rs b/src/commands/open.rs index 4282da8eab..cd3056e81d 100644 --- a/src/commands/open.rs +++ b/src/commands/open.rs @@ -427,7 +427,7 @@ pub fn parse_string_as_value( name_span: Span, ) -> Result, 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, 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( diff --git a/src/commands/skip_while.rs b/src/commands/skip_while.rs index fac080fa87..d0237b16ad 100644 --- a/src/commands/skip_while.rs +++ b/src/commands/skip_while.rs @@ -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, }; diff --git a/src/lib.rs b/src/lib.rs index 74ad22a68e..9becf29f4a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ #![feature(in_band_lifetimes)] #![feature(generators)] #![feature(try_trait)] -#![feature(bind_by_move_pattern_guards)] #![feature(specialization)] #![feature(proc_macro_hygiene)] diff --git a/src/object/base.rs b/src/object/base.rs index b7088a59fd..b8c1a277e1 100644 --- a/src/object/base.rs +++ b/src/object/base.rs @@ -672,9 +672,10 @@ crate fn reject_fields(obj: &Value, fields: &[String], tag: impl Into) -> 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()) } } diff --git a/src/parser/parse_command.rs b/src/parser/parse_command.rs index 4d8204f16b..6677f66170 100644 --- a/src/parser/parse_command.rs +++ b/src/parser/parse_command.rs @@ -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);