Skip to content

Commit 63b5c23

Browse files
d-e-s-odanielocfb
authored andcommitted
Incorporate clippy reported suggestion
Clippy suggests the usage of the vec! macro instead of manually creating an object and resizing it [0]. Follow the suggestion. [0] https://rust-lang.github.io/rust-clippy/master/index.html#/slow_vector_initialization Signed-off-by: Daniel Müller <[email protected]>
1 parent 855eb84 commit 63b5c23

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

libbpf-rs/src/map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,7 @@ impl MapHandle {
793793
let aligned_val_size = self.percpu_aligned_value_size();
794794
let buf_size = self.percpu_buffer_size()?;
795795

796-
let mut value_buf = Vec::new();
797-
value_buf.resize(buf_size, 0);
796+
let mut value_buf = vec![0; buf_size];
798797

799798
for (i, val) in values.iter().enumerate() {
800799
if val.len() != val_size {

0 commit comments

Comments
 (0)