Skip to content

Commit

Permalink
Release v4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dermesser committed Aug 1, 2024
1 parent d6a6d1a commit 8ebf708
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "integer-encoding"
version = "4.0.0"
version = "4.0.1"
authors = ["Lewin Bormann <[email protected]>"]
description = "varint+zigzag and fixedint integer encoding/decoding (https://developers.google.com/protocol-buffers/docs/encoding)"
repository = "https://github.com/dermesser/integer-encoding-rs"
Expand Down
3 changes: 1 addition & 2 deletions src/varint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ pub trait VarInt: Sized + Copy {
/// Helper: Encode a value and return the encoded form as Vec. The Vec must be at least
/// `required_space()` bytes long.
fn encode_var_vec(self) -> Vec<u8> {
let mut v = Vec::new();
v.resize(self.required_space(), 0);
let mut v = vec![0; self.required_space()];
self.encode_var(&mut v);
v
}
Expand Down
2 changes: 1 addition & 1 deletion src/varint_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod tests {
}
for i in 16400 as u64..16500 {
assert_eq!(
u64::decode_var(&i.encode_var_vec().as_slice()).unwrap(),
u64::decode_var(i.encode_var_vec().as_slice()).unwrap(),
(i, 3)
);
}
Expand Down

0 comments on commit 8ebf708

Please sign in to comment.