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 { Ok(RunnableArgs {
args: T::deserialize(&mut deserializer)?, args: T::deserialize(&mut deserializer)?,
context: RunnableContext { context: RunnableContext {
input: input, input,
commands: registry.clone(), commands: registry.clone(),
shell_manager, shell_manager,
name: name_span, name: name_span,
@ -201,7 +201,7 @@ impl CommandArgs {
Ok(RunnableRawArgs { Ok(RunnableRawArgs {
args: T::deserialize(&mut deserializer)?, args: T::deserialize(&mut deserializer)?,
context: RunnableContext { context: RunnableContext {
input: input, input,
commands: registry.clone(), commands: registry.clone(),
shell_manager, shell_manager,
name: name_span, name: name_span,

View File

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

View File

@ -113,7 +113,7 @@ fn run(
} }
} }
Ok(ReturnSuccess::Value(Tagged { item, .. })) => { 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, x => yield x,
} }

View File

@ -123,7 +123,7 @@ fn run(
} }
} }
Ok(ReturnSuccess::Value(Tagged { item, .. })) => { 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, x => yield x,
} }

View File

@ -101,8 +101,8 @@ fn save(
let command_name = format!("to-{}", extension.to_str().unwrap()); let command_name = format!("to-{}", extension.to_str().unwrap());
if let Some(converter) = registry.get_command(&command_name) { if let Some(converter) = registry.get_command(&command_name) {
let new_args = RawCommandArgs { let new_args = RawCommandArgs {
host: host, host,
shell_manager: shell_manager, shell_manager,
call_info: UnevaluatedCallInfo { call_info: UnevaluatedCallInfo {
args: crate::parser::hir::Call { args: crate::parser::hir::Call {
head: raw_args.call_info.args.head, head: raw_args.call_info.args.head,

View File

@ -41,16 +41,6 @@ pub enum ArgumentError {
MissingValueForName(String), 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)] #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Serialize, Deserialize)]
pub struct ShellError { pub struct ShellError {
error: ProximateShellError, error: ProximateShellError,
@ -140,7 +130,7 @@ impl ShellError {
ProximateShellError::ArgumentError { ProximateShellError::ArgumentError {
command: command.into(), command: command.into(),
error: kind, error: kind,
span: span, span,
} }
.start() .start()
} }

View File

@ -278,8 +278,8 @@ struct StructDeserializer<'a, 'de: 'a> {
impl<'a, 'de: 'a> StructDeserializer<'a, 'de> { impl<'a, 'de: 'a> StructDeserializer<'a, 'de> {
fn new(de: &'a mut ConfigDeserializer<'de>, fields: &'static [&'static str]) -> Self { fn new(de: &'a mut ConfigDeserializer<'de>, fields: &'static [&'static str]) -> Self {
StructDeserializer { StructDeserializer {
de: de, de,
fields: fields, fields,
} }
} }
} }