From 74050e7c8cb893447877b8d60c22642d12360086 Mon Sep 17 00:00:00 2001 From: Stephen Akinyemi Date: Tue, 1 Oct 2019 19:22:39 +0100 Subject: [PATCH] Format code --- src/memory/virtualalloc_bytebuf.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/memory/virtualalloc_bytebuf.rs b/src/memory/virtualalloc_bytebuf.rs index 3ec83e6..8a15a0a 100644 --- a/src/memory/virtualalloc_bytebuf.rs +++ b/src/memory/virtualalloc_bytebuf.rs @@ -8,13 +8,13 @@ //! //! NOTE: Pages in this source file refer to wasm32 pages which are defined by the spec as 64KiB in size. -use winapi::shared::ntdef::NULL; -use winapi::shared::minwindef::LPVOID; use winapi::shared::basetsd::SIZE_T; -use winapi::um::winnt::{MEM_RESERVE, MEM_RELEASE, MEM_COMMIT, PAGE_READWRITE}; +use winapi::shared::minwindef::LPVOID; +use winapi::shared::ntdef::NULL; use winapi::um::memoryapi::{VirtualAlloc, VirtualFree}; +use winapi::um::winnt::{MEM_COMMIT, MEM_RELEASE, MEM_RESERVE, PAGE_READWRITE}; -use std::ptr::{NonNull}; +use std::ptr::NonNull; use std::slice; struct VAlloc { @@ -97,14 +97,12 @@ impl VAlloc { // Checking if there is an error with allocating memory pages. if ptr == NULL { - return Err("VirtualAlloc couldn't commit initial pages") + return Err("VirtualAlloc couldn't commit initial pages"); } let base_ptr = NonNull::new(base_ptr).ok_or("VirtualAlloc returned an error")?; - Ok( - Self { ptr: base_ptr, len } - ) + Ok(Self { ptr: base_ptr, len }) } /// Commits more pages `new_len` to be used by @@ -136,7 +134,7 @@ impl VAlloc { // Checking if there is an error with allocating memory pages. if ptr == NULL { - return Err("VirtualAlloc couldn't commit pages on grow") + return Err("VirtualAlloc couldn't commit pages on grow"); } Ok(())