mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 17:08:32 +02:00
Convert Shellerror::GenericError
to named fields (#11230)
# Description Replace `.to_string()` used in `GenericError` with `.into()` as `.into()` seems more popular Replace `Vec::new()` used in `GenericError` with `vec![]` as `vec![]` seems more popular (There are so, so many)
This commit is contained in:
@ -526,14 +526,12 @@ impl EngineState {
|
||||
})
|
||||
})
|
||||
.and_then(|_| {
|
||||
plugin_file.flush().map_err(|err| {
|
||||
ShellError::GenericError(
|
||||
"Error flushing plugin file".to_string(),
|
||||
format! {"{err}"},
|
||||
None,
|
||||
None,
|
||||
Vec::new(),
|
||||
)
|
||||
plugin_file.flush().map_err(|err| ShellError::GenericError {
|
||||
error: "Error flushing plugin file".into(),
|
||||
msg: format! {"{err}"},
|
||||
span: None,
|
||||
help: None,
|
||||
inner: vec![],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -82,13 +82,13 @@ impl Stack {
|
||||
}
|
||||
|
||||
if var_id == NU_VARIABLE_ID || var_id == ENV_VARIABLE_ID {
|
||||
return Err(ShellError::GenericError(
|
||||
"Built-in variables `$env` and `$nu` have no metadata".into(),
|
||||
"no metadata available".into(),
|
||||
Some(span),
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
return Err(ShellError::GenericError {
|
||||
error: "Built-in variables `$env` and `$nu` have no metadata".into(),
|
||||
msg: "no metadata available".into(),
|
||||
span: Some(span),
|
||||
help: None,
|
||||
inner: vec![],
|
||||
});
|
||||
}
|
||||
|
||||
Err(ShellError::VariableNotFoundAtRuntime { span })
|
||||
|
Reference in New Issue
Block a user