diff --git a/list/src/doubly_linked_list.rs b/list/src/doubly_linked_list.rs index 40316520..0a2af246 100644 --- a/list/src/doubly_linked_list.rs +++ b/list/src/doubly_linked_list.rs @@ -164,12 +164,14 @@ impl DoublyLinkedList { node = next_node; } - unsafe { Self::insert_after(node, new_node_ptr); } + unsafe { + Self::insert_after(node, new_node_ptr); + } self.len += 1; } } - pub fn insert_iter>(&mut self, mut pos: usize, iter: I) { + pub fn insert_iter>(&mut self, mut pos: usize, iter: I) { assert!(pos <= self.len); let mut new_list = DoublyLinkedList::from_iter(iter); @@ -379,7 +381,7 @@ impl DoublyLinkedList { pub fn splice(&mut self, _other: &mut Self) { todo!() } - + /// Reverses the order of the elements. pub fn reverse(&mut self) { unsafe { Self::base_reverse(self.head) }; @@ -582,13 +584,13 @@ impl Hash for DoublyLinkedList { } impl Extend for DoublyLinkedList { - fn extend>(&mut self, iter: I) { + fn extend>(&mut self, iter: I) { iter.into_iter().for_each(|value| self.push_back(value)); } } impl FromIterator for DoublyLinkedList { - fn from_iter>(iter: I) -> Self { + fn from_iter>(iter: I) -> Self { let mut list = Self::new(); list.extend(iter); list @@ -674,7 +676,7 @@ impl<'a, T> Iterator for Iter<'a, T> { } } -impl<'a, T> DoubleEndedIterator for Iter<'a, T> { +impl DoubleEndedIterator for Iter<'_, T> { fn next_back(&mut self) -> Option { if self.len == 0 { None @@ -689,7 +691,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { } } -impl<'a, T> ExactSizeIterator for Iter<'a, T> {} +impl ExactSizeIterator for Iter<'_, T> {} impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut T; @@ -721,7 +723,7 @@ impl<'a, T> Iterator for IterMut<'a, T> { } } -impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { +impl DoubleEndedIterator for IterMut<'_, T> { fn next_back(&mut self) -> Option { if self.len == 0 { None @@ -736,7 +738,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { } } -impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} +impl ExactSizeIterator for IterMut<'_, T> {} impl Node { #[must_use] diff --git a/matrix/src/linked_list_sparse_matrix.rs b/matrix/src/linked_list_sparse_matrix.rs index a063f7d5..6b14bf76 100644 --- a/matrix/src/linked_list_sparse_matrix.rs +++ b/matrix/src/linked_list_sparse_matrix.rs @@ -50,8 +50,8 @@ impl LinkedListSparseMatrix { #[must_use] pub fn construct(sparse_matrix: I) -> Self where - I: IntoIterator, - I2: IntoIterator, + I: IntoIterator, + I2: IntoIterator, { let mut head: NodePtr = None; let mut tail: NodePtr = None; @@ -179,7 +179,9 @@ impl LinkedListSparseMatrix { } else if index == len - 1 { self.pop_back(); } else { - unsafe { Self::remove_node(node); } + unsafe { + Self::remove_node(node); + } self.len -= 1; } return Some(value); @@ -358,7 +360,7 @@ impl<'a, T: IsZero> Iterator for Iter<'a, T> { } } -impl<'a, T: IsZero> ExactSizeIterator for Iter<'a, T> {} +impl ExactSizeIterator for Iter<'_, T> {} impl<'a, T: IsZero> Iterator for IterMut<'a, T> { type Item = &'a mut Node; @@ -382,7 +384,7 @@ impl<'a, T: IsZero> Iterator for IterMut<'a, T> { } } -impl<'a, T: IsZero> ExactSizeIterator for IterMut<'a, T> {} +impl ExactSizeIterator for IterMut<'_, T> {} impl Node { #[must_use] @@ -440,7 +442,7 @@ mod tests { [0, 0, 3, 0, 4], [0, 0, 5, 7, 0], [0, 0, 0, 0, 0], - [0, 2, 6, 0, 0] + [0, 2, 6, 0, 0], ]; let sm = LinkedListSparseMatrix::construct(MATRIX); println!("sm: {sm:?}"); @@ -479,7 +481,7 @@ mod tests { [0, 0, 3, 0, 4], [0, 0, 5, 7, 0], [0, 0, 0, 0, 0], - [0, 2, 6, 0, 0] + [0, 2, 6, 0, 0], ]; let sm = LinkedListSparseMatrix::construct(MATRIX); assert_eq!(sm.value(0, 2), Some(3)); @@ -493,7 +495,7 @@ mod tests { [0, 0, 3, 0, 4], [0, 0, 5, 7, 0], [0, 0, 0, 0, 0], - [0, 2, 6, 0, 0] + [0, 2, 6, 0, 0], ]; let mut sm = LinkedListSparseMatrix::construct(MATRIX); let ret = sm.value_mut(0, 2); @@ -509,7 +511,7 @@ mod tests { [0, 0, 3, 0, 4], [0, 0, 5, 7, 0], [0, 0, 0, 0, 0], - [0, 2, 6, 0, 0] + [0, 2, 6, 0, 0], ]; let mut sm = LinkedListSparseMatrix::construct(MATRIX); let ret = sm.add_element(1, 0, 1); @@ -524,7 +526,7 @@ mod tests { [0, 0, 3, 0, 4], [0, 0, 5, 7, 0], [0, 0, 0, 0, 0], - [0, 2, 6, 0, 0] + [0, 2, 6, 0, 0], ]; let mut sm = LinkedListSparseMatrix::construct(MATRIX); let ret = sm.remove_element(1, 0); @@ -533,4 +535,4 @@ mod tests { assert_eq!(ret, Some(6)); assert_eq!(sm.len(), 5); } -} \ No newline at end of file +} diff --git a/vector/src/bitset.rs b/vector/src/bitset.rs index 5b4b9796..a27310e1 100644 --- a/vector/src/bitset.rs +++ b/vector/src/bitset.rs @@ -215,7 +215,7 @@ pub struct BitSetIter<'a> { index: usize, } -impl<'a> Iterator for BitSetIter<'a> { +impl Iterator for BitSetIter<'_> { type Item = bool; fn next(&mut self) -> Option {