From 8504c7a8e6a7527d36595984f7e05c53e553788f Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 1 Sep 2019 23:39:59 +0200 Subject: [PATCH 1/2] Adopt field init shorthand in a few places Found by running 'egrep "(\b[a-zA-Z]+): \1\b" -R src' --- src/commands/command.rs | 4 ++-- src/commands/enter.rs | 2 +- src/commands/open.rs | 2 +- src/commands/post.rs | 2 +- src/commands/save.rs | 4 ++-- src/errors.rs | 2 +- src/parser/deserializer.rs | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/commands/command.rs b/src/commands/command.rs index 10611b41b0..effe9229f7 100644 --- a/src/commands/command.rs +++ b/src/commands/command.rs @@ -168,7 +168,7 @@ impl CommandArgs { Ok(RunnableArgs { args: T::deserialize(&mut deserializer)?, context: RunnableContext { - input: input, + input, commands: registry.clone(), shell_manager, name: name_span, @@ -201,7 +201,7 @@ impl CommandArgs { Ok(RunnableRawArgs { args: T::deserialize(&mut deserializer)?, context: RunnableContext { - input: input, + input, commands: registry.clone(), shell_manager, name: name_span, diff --git a/src/commands/enter.rs b/src/commands/enter.rs index d2170b00d6..dda96ab2e9 100644 --- a/src/commands/enter.rs +++ b/src/commands/enter.rs @@ -109,7 +109,7 @@ impl PerItemCommand for Enter { })) => { yield Ok(ReturnSuccess::Action(CommandAction::EnterValueShell( Tagged { - item: item, + item, tag: contents_tag, }))); } diff --git a/src/commands/open.rs b/src/commands/open.rs index 202f8eae18..1b0ab9e920 100644 --- a/src/commands/open.rs +++ b/src/commands/open.rs @@ -113,7 +113,7 @@ fn run( } } Ok(ReturnSuccess::Value(Tagged { item, .. })) => { - yield Ok(ReturnSuccess::Value(Tagged { item: item, tag: contents_tag })); + yield Ok(ReturnSuccess::Value(Tagged { item, tag: contents_tag })); } x => yield x, } diff --git a/src/commands/post.rs b/src/commands/post.rs index b5084099f8..551e33dd70 100644 --- a/src/commands/post.rs +++ b/src/commands/post.rs @@ -123,7 +123,7 @@ fn run( } } Ok(ReturnSuccess::Value(Tagged { item, .. })) => { - yield Ok(ReturnSuccess::Value(Tagged { item: item, tag: contents_tag })); + yield Ok(ReturnSuccess::Value(Tagged { item, tag: contents_tag })); } x => yield x, } diff --git a/src/commands/save.rs b/src/commands/save.rs index 4723c4bda6..c32c016f4b 100644 --- a/src/commands/save.rs +++ b/src/commands/save.rs @@ -101,8 +101,8 @@ fn save( let command_name = format!("to-{}", extension.to_str().unwrap()); if let Some(converter) = registry.get_command(&command_name) { let new_args = RawCommandArgs { - host: host, - shell_manager: shell_manager, + host, + shell_manager, call_info: UnevaluatedCallInfo { args: crate::parser::hir::Call { head: raw_args.call_info.args.head, diff --git a/src/errors.rs b/src/errors.rs index 3bf0538be5..b412f7cb5c 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -140,7 +140,7 @@ impl ShellError { ProximateShellError::ArgumentError { command: command.into(), error: kind, - span: span, + span, } .start() } diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs index 633a5b49dd..8d6e74828e 100644 --- a/src/parser/deserializer.rs +++ b/src/parser/deserializer.rs @@ -278,8 +278,8 @@ struct StructDeserializer<'a, 'de: 'a> { impl<'a, 'de: 'a> StructDeserializer<'a, 'de> { fn new(de: &'a mut ConfigDeserializer<'de>, fields: &'static [&'static str]) -> Self { StructDeserializer { - de: de, - fields: fields, + de, + fields, } } } From ad3234a9a02a8f56d9f3c77e934868f262e2e6c2 Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 1 Sep 2019 23:41:08 +0200 Subject: [PATCH 2/2] Remove some commented out code --- src/errors.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index b412f7cb5c..a4ae1b85ef 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -41,16 +41,6 @@ pub enum ArgumentError { MissingValueForName(String), } -// pub fn labelled( -// span: impl Into, -// heading: &'a str, -// span_message: &'a str, -// ) -> impl FnOnce(ShellError) -> ShellError + 'a { -// let span = span.into(); - -// move |_| ShellError::labeled_error(heading, span_message, span) -// } - #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Serialize, Deserialize)] pub struct ShellError { error: ProximateShellError,