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 {
|
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,
|
||||||
|
@ -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,
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user