Skip to content

Commit

Permalink
Make drain_from_front/back also panic like it says on the tin in rele…
Browse files Browse the repository at this point in the history
…ase mode.
  • Loading branch information
bodil committed Apr 13, 2019
1 parent 4f4cd00 commit 785b590
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sized_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ where
pub fn drain_from_front(&mut self, other: &mut Self, count: usize) {
let self_len = self.len();
let other_len = other.len();
debug_assert!(self_len + count <= N::USIZE);
debug_assert!(other_len >= count);
assert!(self_len + count <= N::USIZE);
assert!(other_len >= count);
if self.right + count > N::USIZE {
unsafe { Chunk::force_copy(self.left, 0, self_len, self) };
self.right -= self.left;
Expand All @@ -492,8 +492,8 @@ where
pub fn drain_from_back(&mut self, other: &mut Self, count: usize) {
let self_len = self.len();
let other_len = other.len();
debug_assert!(self_len + count <= N::USIZE);
debug_assert!(other_len >= count);
assert!(self_len + count <= N::USIZE);
assert!(other_len >= count);
if self.left < count {
unsafe { Chunk::force_copy(self.left, N::USIZE - self_len, self_len, self) };
self.left = N::USIZE - self_len;
Expand Down

0 comments on commit 785b590

Please sign in to comment.