mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +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:
@ -153,13 +153,13 @@ fn convert_with_precision(val: &str, precision: usize) -> Result<String, ShellEr
|
||||
let val_float = match val.trim().parse::<f64>() {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
return Err(ShellError::GenericError(
|
||||
format!("error converting string [{}] to f64", &val),
|
||||
"".to_string(),
|
||||
None,
|
||||
Some(e.to_string()),
|
||||
Vec::new(),
|
||||
));
|
||||
return Err(ShellError::GenericError {
|
||||
error: format!("error converting string [{}] to f64", &val),
|
||||
msg: "".into(),
|
||||
span: None,
|
||||
help: Some(e.to_string()),
|
||||
inner: vec![],
|
||||
});
|
||||
}
|
||||
};
|
||||
Ok(format!("{val_float:.precision$}"))
|
||||
|
Reference in New Issue
Block a user