Skip to content

Commit ebc5de6

Browse files
committed
Fix the assert condition to check the capacity.
1 parent 79b3ed3 commit ebc5de6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/buffer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ pub struct SpareCapacity<'a, T>(&'a mut Vec<T>);
221221
#[cfg(feature = "alloc")]
222222
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
223223
pub fn spare_capacity<'a, T>(v: &'a mut Vec<T>) -> SpareCapacity<'a, T> {
224-
debug_assert!(
225-
!v.is_empty(),
224+
debug_assert_ne!(
225+
v.capacity(), 0,
226226
"`extend` uses spare capacity, and never allocates new memory, so the `Vec` passed to it should have some spare capacity."
227227
);
228228

0 commit comments

Comments
 (0)