From bcc5527baac743df259b85c9a61a5793a63ce8fc Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 15 Aug 2022 19:28:58 -0700 Subject: [PATCH] Switch return type to just T --- nalgebra-sparse/src/coo.rs | 6 +++--- nalgebra-sparse/tests/unit_tests/coo.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nalgebra-sparse/src/coo.rs b/nalgebra-sparse/src/coo.rs index e047745a..197ef6f4 100644 --- a/nalgebra-sparse/src/coo.rs +++ b/nalgebra-sparse/src/coo.rs @@ -214,7 +214,7 @@ impl CooMatrix { /// Remove a single triplet from the matrix. /// /// This removes the value `v` from the `i`th row and `j`th column in the matrix. - pub fn clear_triplet(&mut self, i: usize, j: usize, v: T) -> Option<(usize, usize, T)> + pub fn clear_triplet(&mut self, i: usize, j: usize, v: T) -> Option where T: PartialEq, { @@ -224,8 +224,8 @@ impl CooMatrix { if let Some(triple_idx) = triple_idx { self.row_indices.remove(triple_idx); self.col_indices.remove(triple_idx); - let retv = self.values.remove(triple_idx); - Some((i, j, retv)) + let removed_value = self.values.remove(triple_idx); + Some(removed_value) } else { None } diff --git a/nalgebra-sparse/tests/unit_tests/coo.rs b/nalgebra-sparse/tests/unit_tests/coo.rs index 6ec88fb1..4b640596 100644 --- a/nalgebra-sparse/tests/unit_tests/coo.rs +++ b/nalgebra-sparse/tests/unit_tests/coo.rs @@ -242,16 +242,16 @@ fn coo_clear_triplet_valid_entries() { vec![(0, 0, &1), (0, 0, &2), (2, 2, &3)] ); let triplet = coo.clear_triplet(0, 0, 1); - assert_eq!(triplet, Some((0, 0, 1))); + assert_eq!(triplet, Some(1)); assert_eq!( coo.triplet_iter().collect::>(), vec![(0, 0, &2), (2, 2, &3)] ); let triplet = coo.clear_triplet(0, 0, 2); - assert_eq!(triplet, Some((0, 0, 2))); + assert_eq!(triplet, Some(2)); assert_eq!(coo.triplet_iter().collect::>(), vec![(2, 2, &3)]); let triplet = coo.clear_triplet(2, 2, 3); - assert_eq!(triplet, Some((2, 2, 3))); + assert_eq!(triplet, Some(3)); assert_eq!(coo.triplet_iter().collect::>(), vec![]); }