mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 18:15:04 +02:00
Remove as_i64
and as_f64
(#14258)
# Description Turns out there are duplicate conversion functions: `as_i64` and `as_f64`. In most cases, these can be replaced with `as_int` and `as_float`, respectively.
This commit is contained in:
@ -47,9 +47,9 @@ impl PluginCommand for Sum {
|
||||
) -> Result<PipelineData, LabeledError> {
|
||||
let mut acc = IntOrFloat::Int(0);
|
||||
for value in input {
|
||||
if let Ok(n) = value.as_i64() {
|
||||
if let Ok(n) = value.as_int() {
|
||||
acc.add_i64(n);
|
||||
} else if let Ok(n) = value.as_f64() {
|
||||
} else if let Ok(n) = value.as_float() {
|
||||
acc.add_f64(n);
|
||||
} else {
|
||||
return Err(LabeledError::new("Sum only accepts ints and floats")
|
||||
|
Reference in New Issue
Block a user