From f400cee91114dad98c59c2c6fa9569cb851bc46e Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Sat, 11 Dec 2021 06:13:50 +0000 Subject: [PATCH] Simplified trait bounds. --- src/compute/arithmetics/basic/add.rs | 4 ++-- src/compute/arithmetics/basic/div.rs | 8 ++++---- src/compute/arithmetics/basic/mul.rs | 2 +- src/compute/arithmetics/basic/pow.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compute/arithmetics/basic/add.rs b/src/compute/arithmetics/basic/add.rs index c89f2cd8cd0..d1002ab97d5 100644 --- a/src/compute/arithmetics/basic/add.rs +++ b/src/compute/arithmetics/basic/add.rs @@ -1,7 +1,7 @@ //! Definition of basic add operations with primitive arrays use std::ops::Add; -use num_traits::{ops::overflowing::OverflowingAdd, CheckedAdd, SaturatingAdd, WrappingAdd, Zero}; +use num_traits::{ops::overflowing::OverflowingAdd, CheckedAdd, SaturatingAdd, WrappingAdd}; use crate::{ array::{Array, PrimitiveArray}, @@ -313,7 +313,7 @@ where // Implementation of ArrayCheckedAdd trait for PrimitiveArrays with a scalar impl ArrayCheckedAdd for PrimitiveArray where - T: NativeArithmetics + CheckedAdd + Zero, + T: NativeArithmetics + CheckedAdd, { fn checked_add(&self, rhs: &T) -> Self { checked_add_scalar(self, rhs) diff --git a/src/compute/arithmetics/basic/div.rs b/src/compute/arithmetics/basic/div.rs index 2592ca4878a..1f805811073 100644 --- a/src/compute/arithmetics/basic/div.rs +++ b/src/compute/arithmetics/basic/div.rs @@ -1,7 +1,7 @@ //! Definition of basic div operations with primitive arrays use std::ops::Div; -use num_traits::{CheckedDiv, NumCast, Zero}; +use num_traits::{CheckedDiv, NumCast}; use crate::datatypes::DataType; use crate::{ @@ -191,7 +191,7 @@ where /// ``` pub fn checked_div_scalar(lhs: &PrimitiveArray, rhs: &T) -> PrimitiveArray where - T: NativeArithmetics + CheckedDiv + Zero, + T: NativeArithmetics + CheckedDiv, { let rhs = *rhs; let op = move |a: T| a.checked_div(&rhs); @@ -202,7 +202,7 @@ where // Implementation of ArrayDiv trait for PrimitiveArrays with a scalar impl ArrayDiv for PrimitiveArray where - T: NativeArithmetics + Div + NativeArithmetics + NumCast, + T: NativeArithmetics + Div + NumCast, { fn div(&self, rhs: &T) -> Self { div_scalar(self, rhs) @@ -212,7 +212,7 @@ where // Implementation of ArrayCheckedDiv trait for PrimitiveArrays with a scalar impl ArrayCheckedDiv for PrimitiveArray where - T: NativeArithmetics + CheckedDiv + Zero + NativeArithmetics, + T: NativeArithmetics + CheckedDiv, { fn checked_div(&self, rhs: &T) -> Self { checked_div_scalar(self, rhs) diff --git a/src/compute/arithmetics/basic/mul.rs b/src/compute/arithmetics/basic/mul.rs index 6b3ae4b4d08..c986403ae67 100644 --- a/src/compute/arithmetics/basic/mul.rs +++ b/src/compute/arithmetics/basic/mul.rs @@ -304,7 +304,7 @@ where // Implementation of ArrayMul trait for PrimitiveArrays with a scalar impl ArrayMul for PrimitiveArray where - T: NativeArithmetics + Mul + NativeArithmetics, + T: NativeArithmetics + Mul, { fn mul(&self, rhs: &T) -> Self { mul_scalar(self, rhs) diff --git a/src/compute/arithmetics/basic/pow.rs b/src/compute/arithmetics/basic/pow.rs index e2e28deb9ba..71138893070 100644 --- a/src/compute/arithmetics/basic/pow.rs +++ b/src/compute/arithmetics/basic/pow.rs @@ -1,5 +1,5 @@ //! Definition of basic pow operations with primitive arrays -use num_traits::{checked_pow, CheckedMul, One, Pow, Zero}; +use num_traits::{checked_pow, CheckedMul, One, Pow}; use crate::{ array::{Array, PrimitiveArray}, @@ -44,7 +44,7 @@ where /// ``` pub fn checked_powf_scalar(array: &PrimitiveArray, exponent: usize) -> PrimitiveArray where - T: NativeArithmetics + Zero + One + CheckedMul, + T: NativeArithmetics + CheckedMul + One, { let op = move |a: T| checked_pow(a, exponent);