Skip to content

Commit

Permalink
clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivaswatha committed Sep 8, 2024
1 parent 32df01b commit 6a3ffa6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ impl<'a, T: LinkedList> Iterator for Iter<'a, T> {
type Item = Ptr<T>;

fn next(&mut self) -> Option<Self::Item> {
self.next.map(|curr| {
if curr
self.next.inspect(|curr| {
if *curr
== self
.next_back
.expect("Some(next) => Some(next_back) violated")
Expand All @@ -78,7 +78,6 @@ impl<'a, T: LinkedList> Iterator for Iter<'a, T> {
} else {
self.next = curr.deref(self.ctx).get_next();
}
curr
})
}

Expand All @@ -89,14 +88,13 @@ impl<'a, T: LinkedList> Iterator for Iter<'a, T> {

impl<'a, T: LinkedList> DoubleEndedIterator for Iter<'a, T> {
fn next_back(&mut self) -> Option<Self::Item> {
self.next_back.map(|curr| {
if curr == self.next.expect("Some(next_back) => Some(next) violated") {
self.next_back.inspect(|curr| {
if *curr == self.next.expect("Some(next_back) => Some(next) violated") {
self.next_back = None;
self.next = None;
} else {
self.next_back = curr.deref(self.ctx).get_prev();
}
curr
})
}
}
Expand Down

0 comments on commit 6a3ffa6

Please sign in to comment.