Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
agerasev committed Aug 1, 2023
1 parent 2df5e2c commit 5593941
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/halves/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<R: RbRef> Consumer for CachingCons<R> {
unsafe { PopIter::new(self.frozen.into_rb_ref()) }
}

type PopIter<'a> = PopIter<&'a R::Target> where R:'a, R::Target: 'a;
type PopIter<'a> = PopIter<&'a R::Target> where R:'a;
fn pop_iter(&mut self) -> Self::PopIter<'_> {
unsafe { PopIter::new(self.frozen.rb_ref().deref()) }
}
Expand Down
6 changes: 3 additions & 3 deletions src/halves/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
iter::PopIter,
traits::{RbRef, ToRbRef},
},
traits::{Consumer, Observe, Observer, Producer, RingBuffer},
traits::{Consumer, Observe, Observer, Producer},
};

/// Observer of ring buffer.
Expand Down Expand Up @@ -100,9 +100,9 @@ impl<R: RbRef> Consumer for Cons<R> {
unsafe { PopIter::new(self.rb) }
}

type PopIter<'a> = PopIter<&'a R::Target> where R:'a, R::Target: 'a;
type PopIter<'a> = PopIter<&'a R::Target> where R:'a;
fn pop_iter(&mut self) -> Self::PopIter<'_> {
unsafe { PopIter::new(&self.rb.deref()) }
unsafe { PopIter::new(self.rb.deref()) }
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/halves/frozen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ impl<R: RbRef> Consumer for FrozenCons<R> {
unsafe { PopIter::new(self.into_rb_ref()) }
}

type PopIter<'a> = PopIter<&'a R::Target> where R:'a, R::Target: 'a;
type PopIter<'a> = PopIter<&'a R::Target> where R:'a;
fn pop_iter(&mut self) -> Self::PopIter<'_> {
unsafe { PopIter::new(&self.rb.deref()) }
unsafe { PopIter::new(self.rb.deref()) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/rb/traits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::traits::{Consumer, Producer, RingBuffer};
use crate::traits::RingBuffer;
#[cfg(feature = "alloc")]
use alloc::{rc::Rc, sync::Arc};

Expand Down
8 changes: 4 additions & 4 deletions src/tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ fn push_pop_iter_partial() {
prod.try_push(0).unwrap();
prod.try_push(1).unwrap();
prod.try_push(2).unwrap();
for (i, v) in (0..2).zip(cons.pop_iter()) {
assert_eq!(i, v);
for (i, v) in cons.pop_iter().take(2).enumerate() {
assert_eq!(i as i32, v);
}

prod.try_push(3).unwrap();
prod.try_push(4).unwrap();
prod.try_push(5).unwrap();
for (i, v) in (2..5).zip(cons.pop_iter()) {
assert_eq!(i, v);
for (i, v) in cons.pop_iter().enumerate() {
assert_eq!(i as i32 + 2, v);
}
assert_eq!(cons.try_pop().unwrap(), 5);
assert!(prod.is_empty());
Expand Down

0 comments on commit 5593941

Please sign in to comment.