Merge pull request #563 from est31/field_shorthand

Adopt field init shorthand in a few places
This commit is contained in:
Jonathan Turner 2019-09-02 11:45:32 +12:00 committed by GitHub
commit 6e0cb6b809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 20 deletions

View File

@ -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,

View File

@ -109,7 +109,7 @@ impl PerItemCommand for Enter {
})) => {
yield Ok(ReturnSuccess::Action(CommandAction::EnterValueShell(
Tagged {
item: item,
item,
tag: contents_tag,
})));
}

View File

@ -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,
}

View File

@ -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,
}

View File

@ -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,

View File

@ -41,16 +41,6 @@ pub enum ArgumentError {
MissingValueForName(String),
}
// pub fn labelled(
// span: impl Into<Span>,
// 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,
@ -140,7 +130,7 @@ impl ShellError {
ProximateShellError::ArgumentError {
command: command.into(),
error: kind,
span: span,
span,
}
.start()
}

View File

@ -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,
}
}
}