From 3f407772284e6abfb6220e16033855c2c652b512 Mon Sep 17 00:00:00 2001 From: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> Date: Mon, 29 Jun 2020 11:50:38 +1000 Subject: [PATCH] [*.rs] rustfmt --- lib.rs | 18 +++++++++++------- tests/macro.rs | 1 - 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib.rs b/lib.rs index f04fe61..6bf4ee1 100644 --- a/lib.rs +++ b/lib.rs @@ -247,11 +247,11 @@ fn infallible(result: Result) -> T { /// FIXME: use `Layout::array` when we require a Rust version where it’s stable /// https://github.com/rust-lang/rust/issues/55724 fn layout_array(n: usize) -> Result { - let size = mem::size_of::().checked_mul(n) + let size = mem::size_of::() + .checked_mul(n) .ok_or(CollectionAllocErr::CapacityOverflow)?; let align = mem::align_of::(); - Layout::from_size_align(size, align) - .map_err(|_| CollectionAllocErr::CapacityOverflow) + Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) } unsafe fn deallocate(ptr: *mut T, capacity: usize) { @@ -1834,7 +1834,9 @@ impl<'a> Drop for SetLenOnDrop<'a> { #[cfg(feature = "const_generics")] unsafe impl Array for [T; N] { type Item = T; - fn size() -> usize { N } + fn size() -> usize { + N + } } #[cfg(not(feature = "const_generics"))] @@ -1857,13 +1859,15 @@ impl_array!( ); /// Convenience trait for constructing a `SmallVec` -pub trait ToSmallVec { +pub trait ToSmallVec { /// Construct a new `SmallVec` from a slice. fn to_smallvec(&self) -> SmallVec; } -impl ToSmallVec for [A::Item] - where A::Item: Copy { +impl ToSmallVec for [A::Item] +where + A::Item: Copy, +{ #[inline] fn to_smallvec(&self) -> SmallVec { SmallVec::from_slice(self) diff --git a/tests/macro.rs b/tests/macro.rs index 6ecb8a9..fa52e79 100644 --- a/tests/macro.rs +++ b/tests/macro.rs @@ -22,4 +22,3 @@ fn smallvec() { check!([1, 2]); check!([1, 2, 3]); } -