Skip to content

Commit

Permalink
style: include redundant_clone (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 authored Jan 12, 2025
1 parent ff1df12 commit d90950d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ imprecise_flops = { level = "allow", priority = 1 }
missing_const_for_fn = { level = "allow", priority = 1 }
nonstandard_macro_braces = { level = "allow", priority = 1 }
option_if_let_else = { level = "allow", priority = 1 }
redundant_clone = { level = "allow", priority = 1 }
suboptimal_flops = { level = "allow", priority = 1 }
suspicious_operation_groupings = { level = "allow", priority = 1 }
use_self = { level = "allow", priority = 1 }
Expand Down
4 changes: 2 additions & 2 deletions src/graph/decremental_connectivity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ mod tests {
HashSet::from([7, 8]),
HashSet::from([7]),
];
let mut dec_con = super::DecrementalConnectivity::new(adjacent.clone()).unwrap();
let mut dec_con = super::DecrementalConnectivity::new(adjacent).unwrap();
dec_con.delete(2, 4);
}

Expand Down Expand Up @@ -260,7 +260,7 @@ mod tests {
dec_con2.delete(4, 1);
assert!(!dec_con2.connected(1, 4).unwrap());

let mut dec_con3 = super::DecrementalConnectivity::new(adjacent.clone()).unwrap();
let mut dec_con3 = super::DecrementalConnectivity::new(adjacent).unwrap();
dec_con3.delete(1, 4);
assert!(!dec_con3.connected(4, 1).unwrap());
}
Expand Down
4 changes: 2 additions & 2 deletions src/machine_learning/cholesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mod tests {
fn test_cholesky() {
// Test case 1
let mat1 = vec![25.0, 15.0, -5.0, 15.0, 18.0, 0.0, -5.0, 0.0, 11.0];
let res1 = cholesky(mat1.clone(), 3);
let res1 = cholesky(mat1, 3);

// The expected Cholesky decomposition values
#[allow(clippy::useless_vec)]
Expand Down Expand Up @@ -92,7 +92,7 @@ mod tests {
#[test]
fn matrix_with_all_zeros() {
let mat3 = vec![0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
let res3 = cholesky(mat3.clone(), 3);
let res3 = cholesky(mat3, 3);
let expected3 = vec![0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
assert_eq!(res3, expected3);
}
Expand Down
2 changes: 1 addition & 1 deletion src/math/softmax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use std::f32::consts::E;

pub fn softmax(array: Vec<f32>) -> Vec<f32> {
let mut softmax_array = array.clone();
let mut softmax_array = array;

for value in &mut softmax_array {
*value = E.powf(*value);
Expand Down

0 comments on commit d90950d

Please sign in to comment.