Skip to content

Commit

Permalink
Fix Clippy warning on memory allocation. (#130)
Browse files Browse the repository at this point in the history
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
  • Loading branch information
Swaagie committed Jan 31, 2022
1 parent a91ad0d commit cf7894e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/allocator.rs
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::mem::MaybeUninit;

#[cfg(feature = "wee-alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
Expand All @@ -22,7 +24,7 @@ static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
)]
#[no_mangle]
pub extern "C" fn proxy_on_memory_allocate(size: usize) -> *mut u8 {
let mut vec: Vec<u8> = Vec::with_capacity(size);
let mut vec: Vec<MaybeUninit<u8>> = Vec::with_capacity(size);
unsafe {
vec.set_len(size);
}
Expand Down

0 comments on commit cf7894e

Please sign in to comment.