From 8cdf598be4e2a612be7f31f7944113b6c4a96c27 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Fri, 20 Sep 2019 09:10:03 -0600 Subject: [PATCH] formatting --- src/allocation.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/allocation.rs b/src/allocation.rs index 344caa4..35fa66c 100644 --- a/src/allocation.rs +++ b/src/allocation.rs @@ -1,9 +1,13 @@ //! Stuff to boost things in the `alloc` crate. use super::*; -use alloc::{boxed::Box, rc::Rc, sync::Arc, vec::Vec}; -use alloc::alloc::Layout; -use alloc::alloc::alloc_zeroed; +use alloc::{ + alloc::{alloc_zeroed, Layout}, + boxed::Box, + rc::Rc, + sync::Arc, + vec::Vec, +}; /// As [`try_cast_box`](try_cast_box), but unwraps for you. #[inline] @@ -39,7 +43,7 @@ pub fn try_cast_box(input: Box) -> Result, (PodCastErr /// the contents of the box never exists on the stack, so this can create very /// large boxes without fear of a stack overflow. #[inline] -pub fn try_zeroed_box() -> Result,()> { +pub fn try_zeroed_box() -> Result, ()> { let layout = Layout::from_size_align(size_of::(), align_of::()).unwrap(); let ptr = unsafe { alloc_zeroed(layout) }; if ptr.is_null() { @@ -52,7 +56,7 @@ pub fn try_zeroed_box() -> Result,()> { /// As [`try_zeroed_box`], but unwraps for you. #[inline] -pub fn zeroed_box() -> Box { +pub fn zeroed_box() -> Box { try_zeroed_box().unwrap() }