Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Simplified trait bounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Dec 11, 2021
1 parent 2b86bc9 commit f400cee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/compute/arithmetics/basic/add.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -313,7 +313,7 @@ where
// Implementation of ArrayCheckedAdd trait for PrimitiveArrays with a scalar
impl<T> ArrayCheckedAdd<T> for PrimitiveArray<T>
where
T: NativeArithmetics + CheckedAdd<Output = T> + Zero,
T: NativeArithmetics + CheckedAdd<Output = T>,
{
fn checked_add(&self, rhs: &T) -> Self {
checked_add_scalar(self, rhs)
Expand Down
8 changes: 4 additions & 4 deletions src/compute/arithmetics/basic/div.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -191,7 +191,7 @@ where
/// ```
pub fn checked_div_scalar<T>(lhs: &PrimitiveArray<T>, rhs: &T) -> PrimitiveArray<T>
where
T: NativeArithmetics + CheckedDiv<Output = T> + Zero,
T: NativeArithmetics + CheckedDiv<Output = T>,
{
let rhs = *rhs;
let op = move |a: T| a.checked_div(&rhs);
Expand All @@ -202,7 +202,7 @@ where
// Implementation of ArrayDiv trait for PrimitiveArrays with a scalar
impl<T> ArrayDiv<T> for PrimitiveArray<T>
where
T: NativeArithmetics + Div<Output = T> + NativeArithmetics + NumCast,
T: NativeArithmetics + Div<Output = T> + NumCast,
{
fn div(&self, rhs: &T) -> Self {
div_scalar(self, rhs)
Expand All @@ -212,7 +212,7 @@ where
// Implementation of ArrayCheckedDiv trait for PrimitiveArrays with a scalar
impl<T> ArrayCheckedDiv<T> for PrimitiveArray<T>
where
T: NativeArithmetics + CheckedDiv<Output = T> + Zero + NativeArithmetics,
T: NativeArithmetics + CheckedDiv<Output = T>,
{
fn checked_div(&self, rhs: &T) -> Self {
checked_div_scalar(self, rhs)
Expand Down
2 changes: 1 addition & 1 deletion src/compute/arithmetics/basic/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ where
// Implementation of ArrayMul trait for PrimitiveArrays with a scalar
impl<T> ArrayMul<T> for PrimitiveArray<T>
where
T: NativeArithmetics + Mul<Output = T> + NativeArithmetics,
T: NativeArithmetics + Mul<Output = T>,
{
fn mul(&self, rhs: &T) -> Self {
mul_scalar(self, rhs)
Expand Down
4 changes: 2 additions & 2 deletions src/compute/arithmetics/basic/pow.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -44,7 +44,7 @@ where
/// ```
pub fn checked_powf_scalar<T>(array: &PrimitiveArray<T>, exponent: usize) -> PrimitiveArray<T>
where
T: NativeArithmetics + Zero + One + CheckedMul,
T: NativeArithmetics + CheckedMul + One,
{
let op = move |a: T| checked_pow(a, exponent);

Expand Down

0 comments on commit f400cee

Please sign in to comment.