mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 18:21:40 +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:
@ -88,13 +88,13 @@ impl Command for SubCommand {
|
||||
let to_trim = match character.as_ref() {
|
||||
Some(v) => {
|
||||
if v.item.chars().count() > 1 {
|
||||
return Err(ShellError::GenericError(
|
||||
"Trim only works with single character".into(),
|
||||
"needs single character".into(),
|
||||
Some(v.span),
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
return Err(ShellError::GenericError {
|
||||
error: "Trim only works with single character".into(),
|
||||
msg: "needs single character".into(),
|
||||
span: Some(v.span),
|
||||
help: None,
|
||||
inner: vec![],
|
||||
});
|
||||
}
|
||||
v.item.chars().next()
|
||||
}
|
||||
|
Reference in New Issue
Block a user