Skip to content

Commit

Permalink
appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Jun 19, 2024
1 parent 5e9955a commit 68ab335
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pallets/subtensor/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub fn inplace_normalize(x: &mut [I32F32]) {
if x_sum == I32F32::from_num(0.0_f32) {
return;
}
x.into_iter()
x.iter_mut()
.for_each(|value| *value = value.saturating_div(x_sum));
}

Expand All @@ -262,7 +262,7 @@ pub fn inplace_normalize_using_sum(x: &mut [I32F32], x_sum: I32F32) {
if x_sum == I32F32::from_num(0.0_f32) {
return;
}
x.into_iter()
x.iter_mut()
.for_each(|value| *value = value.saturating_div(x_sum));
}

Expand All @@ -273,7 +273,7 @@ pub fn inplace_normalize_64(x: &mut [I64F64]) {
if x_sum == I64F64::from_num(0) {
return;
}
x.into_iter()
x.iter_mut()
.for_each(|value| *value = value.saturating_div(x_sum));
}

Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn inplace_row_normalize(x: &mut [Vec<I32F32>]) {
for row in x {
let row_sum: I32F32 = row.iter().sum();
if row_sum > I32F32::from_num(0.0_f32) {
row.into_iter()
row.iter_mut()
.for_each(|x_ij: &mut I32F32| *x_ij = x_ij.saturating_div(row_sum));
}
}
Expand Down Expand Up @@ -622,7 +622,7 @@ pub fn row_hadamard(matrix: &[Vec<I32F32>], vector: &[I32F32]) -> Vec<Vec<I32F32
.iter()
.zip(vector)
.map(|(row, vec_val)| {
row.into_iter()
row.iter()
.map(|m_val| vec_val.saturating_mul(*m_val))
.collect()
})
Expand All @@ -640,7 +640,7 @@ pub fn row_hadamard_sparse(
.zip(vector)
.map(|(sparse_row, vec_val)| {
sparse_row
.into_iter()
.iter()
.map(|(j, value)| (*j, value.saturating_mul(*vec_val)))
.collect()
})
Expand Down

0 comments on commit 68ab335

Please sign in to comment.