forked from extern/nushell
Merge pull request #563 from est31/field_shorthand
Adopt field init shorthand in a few places
This commit is contained in:
commit
6e0cb6b809
@ -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,
|
||||
|
@ -109,7 +109,7 @@ impl PerItemCommand for Enter {
|
||||
})) => {
|
||||
yield Ok(ReturnSuccess::Action(CommandAction::EnterValueShell(
|
||||
Tagged {
|
||||
item: item,
|
||||
item,
|
||||
tag: contents_tag,
|
||||
})));
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user