Skip to content

Commit 651ac84

Browse files
authored
Fix Array::resize_raw() to allow resizing to the length of the array. (#63)
The `new_len` parameter to Array::resize_raw() is the new length of the contained octets sequence. The documentation for resize_raw() specifies that it is an error for `new_len` to be larger than the array size, but the current code also returns an error if `new_len` is equal to the array size.
1 parent 837ea25 commit 651ac84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<const N: usize> Array<N> {
4242
///
4343
/// Returns an error if `new_len` is larger than the array size.
4444
pub fn resize_raw(&mut self, new_len: usize) -> Result<(), ShortBuf> {
45-
if new_len >= N {
45+
if new_len > N {
4646
Err(ShortBuf)
4747
}
4848
else {

0 commit comments

Comments
 (0)