Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ pub(crate) fn check_null_bytes(data: &[u8]) -> Result<bool, Error> {
}

/// This function copies the slice into a vec and appends an element to its end.
/// The vec is allocated with reserve_exact.
pub(crate) fn copy_and_push<T: Copy>(data: &[T], to_push: T) -> alloc::vec::Vec<T> {
let mut copy = alloc::vec::Vec::new();
copy.reserve_exact(data.len() + 1);
let mut copy = alloc::vec::Vec::with_capacity(data.len() + 1);
copy.extend_from_slice(data);
copy.push(to_push);
copy
Expand Down
Loading