From c7a6b3caae3131fe8d1a3373cf300976db4ef8df Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 23 Jul 2019 00:48:11 +0300 Subject: [PATCH] Remove unnecessary check in dc_array_new_typed Allocating Vec with 0 capacity is correct. --- src/dc_array.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dc_array.rs b/src/dc_array.rs index 66bdac279..7bff7823f 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -256,8 +256,7 @@ pub fn dc_array_new(initsize: size_t) -> *mut dc_array_t { } pub fn dc_array_new_typed(type_0: libc::c_int, initsize: size_t) -> *mut dc_array_t { - let capacity = if initsize < 1 { 1 } else { initsize as usize }; - let mut array = dc_array_t::new(capacity); + let mut array = dc_array_t::new(initsize); array.type_0 = type_0; array.as_ptr() }