Skip to content

Commit dcbbac3

Browse files
committed
clippy
Signed-off-by: Robert Kruszewski <[email protected]>
1 parent 691223e commit dcbbac3

File tree

1 file changed

+16
-18
lines changed
  • vortex-array/src/compute

1 file changed

+16
-18
lines changed

vortex-array/src/compute/sum.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ impl ComputeFnVTable for Sum {
110110
let sum_from_stat = accumulator
111111
.as_primitive()
112112
.checked_add(&sum.as_primitive())
113-
.map(|s| Scalar::from(s));
113+
.map(Scalar::from);
114114
return Ok(sum_from_stat
115115
.unwrap_or_else(|| Scalar::null(sum_dtype))
116116
.into());
117117
} else if sum_dtype.is_decimal() {
118118
let sum_from_stat = accumulator
119119
.as_decimal()
120120
.checked_binary_numeric(&sum.as_decimal(), NumericOperator::Add)
121-
.map(|s| Scalar::from(s));
121+
.map(Scalar::from);
122122
return Ok(sum_from_stat
123123
.unwrap_or_else(|| Scalar::null(sum_dtype))
124124
.into());
@@ -132,26 +132,24 @@ impl ComputeFnVTable for Sum {
132132
array
133133
.statistics()
134134
.set(Stat::Sum, Precision::Exact(sum_scalar.value().clone()));
135-
} else if sum_dtype.is_int() {
136-
if let Some(less_accumulator) = sum_scalar
135+
} else if sum_dtype.is_int()
136+
&& let Some(less_accumulator) = sum_scalar
137137
.as_primitive()
138138
.checked_sub(&accumulator.as_primitive())
139-
{
140-
array.statistics().set(
141-
Stat::Sum,
142-
Precision::Exact(Scalar::from(less_accumulator).value().clone()),
143-
);
144-
}
145-
} else if sum_dtype.is_decimal() {
146-
if let Some(less_accumulator) = sum_scalar
139+
{
140+
array.statistics().set(
141+
Stat::Sum,
142+
Precision::Exact(Scalar::from(less_accumulator).value().clone()),
143+
);
144+
} else if sum_dtype.is_decimal()
145+
&& let Some(less_accumulator) = sum_scalar
147146
.as_decimal()
148147
.checked_binary_numeric(&accumulator.as_decimal(), NumericOperator::Sub)
149-
{
150-
array.statistics().set(
151-
Stat::Sum,
152-
Precision::Exact(Scalar::from(less_accumulator).value().clone()),
153-
);
154-
}
148+
{
149+
array.statistics().set(
150+
Stat::Sum,
151+
Precision::Exact(Scalar::from(less_accumulator).value().clone()),
152+
);
155153
}
156154

157155
Ok(sum_scalar.into())

0 commit comments

Comments
 (0)