mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 18:15:04 +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:
14
crates/nu-command/src/env/config/config_env.rs
vendored
14
crates/nu-command/src/env/config/config_env.rs
vendored
@ -68,13 +68,13 @@ impl Command for ConfigEnv {
|
||||
let nu_config = match engine_state.get_config_path("env-path") {
|
||||
Some(path) => path.clone(),
|
||||
None => {
|
||||
return Err(ShellError::GenericError(
|
||||
"Could not find $nu.env-path".to_string(),
|
||||
"Could not find $nu.env-path".to_string(),
|
||||
None,
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
return Err(ShellError::GenericError {
|
||||
error: "Could not find $nu.env-path".into(),
|
||||
msg: "Could not find $nu.env-path".into(),
|
||||
span: None,
|
||||
help: None,
|
||||
inner: vec![],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
14
crates/nu-command/src/env/config/config_nu.rs
vendored
14
crates/nu-command/src/env/config/config_nu.rs
vendored
@ -72,13 +72,13 @@ impl Command for ConfigNu {
|
||||
let nu_config = match engine_state.get_config_path("config-path") {
|
||||
Some(path) => path.clone(),
|
||||
None => {
|
||||
return Err(ShellError::GenericError(
|
||||
"Could not find $nu.config-path".to_string(),
|
||||
"Could not find $nu.config-path".to_string(),
|
||||
None,
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
return Err(ShellError::GenericError {
|
||||
error: "Could not find $nu.config-path".into(),
|
||||
msg: "Could not find $nu.config-path".into(),
|
||||
span: None,
|
||||
help: None,
|
||||
inner: vec![],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
14
crates/nu-command/src/env/config/config_reset.rs
vendored
14
crates/nu-command/src/env/config/config_reset.rs
vendored
@ -51,13 +51,13 @@ impl Command for ConfigReset {
|
||||
let mut config_path = match nu_path::config_dir() {
|
||||
Some(path) => path,
|
||||
None => {
|
||||
return Err(ShellError::GenericError(
|
||||
"Could not find config path".to_string(),
|
||||
"Could not find config path".to_string(),
|
||||
None,
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
return Err(ShellError::GenericError {
|
||||
error: "Could not find config path".into(),
|
||||
msg: "Could not find config path".into(),
|
||||
span: None,
|
||||
help: None,
|
||||
inner: vec![],
|
||||
});
|
||||
}
|
||||
};
|
||||
config_path.push("nushell");
|
||||
|
Reference in New Issue
Block a user