From 8c004c08580287172585169807ed36933ad674f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 11 Apr 2019 22:12:41 +0200 Subject: style: Reformat recent changes. --- components/to_shmem/lib.rs | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'components/to_shmem') diff --git a/components/to_shmem/lib.rs b/components/to_shmem/lib.rs index db6efe20895..59fc2afb546 100644 --- a/components/to_shmem/lib.rs +++ b/components/to_shmem/lib.rs @@ -24,17 +24,17 @@ use smallvec::{Array, SmallVec}; use std::alloc::Layout; #[cfg(debug_assertions)] use std::any::TypeId; -use std::isize; #[cfg(debug_assertions)] use std::collections::HashSet; use std::ffi::CString; +use std::isize; use std::marker::PhantomData; use std::mem::{self, ManuallyDrop}; use std::num::Wrapping; use std::ops::Range; +use std::os::raw::c_char; #[cfg(debug_assertions)] use std::os::raw::c_void; -use std::os::raw::c_char; use std::ptr::{self, NonNull}; use std::slice; use std::str; @@ -166,7 +166,7 @@ impl SharedMemoryBuilder { // Reserve space for the padding. let start = self.index.checked_add(padding).unwrap(); - assert!(start <= std::isize::MAX as usize); // for the cast below + assert!(start <= std::isize::MAX as usize); // for the cast below // Reserve space for the value. let end = start.checked_add(layout.size()).unwrap(); @@ -205,7 +205,22 @@ macro_rules! impl_trivial_to_shmem { )*}; } -impl_trivial_to_shmem!((), bool, f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, isize, usize); +impl_trivial_to_shmem!( + (), + bool, + f32, + f64, + i8, + i16, + i32, + i64, + u8, + u16, + u32, + u64, + isize, + usize +); impl_trivial_to_shmem!(cssparser::RGBA); impl_trivial_to_shmem!(cssparser::SourceLocation); @@ -424,7 +439,9 @@ impl ToShmem for Arc { #[cfg(debug_assertions)] assert!( !builder.shared_values.contains(&self.heap_ptr()) || - builder.allowed_duplication_types.contains(&TypeId::of::()), + builder + .allowed_duplication_types + .contains(&TypeId::of::()), "ToShmem failed for Arc: encountered a value of type T with multiple references \ and which has not been explicitly allowed with an add_allowed_duplication_type call", ); @@ -463,11 +480,7 @@ impl ToShmem for ThinArc { // Make a clone of the Arc-owned header and slice values with all of // their heap allocations placed in the shared memory buffer. let header = self.header.header.to_shmem(builder); - let values: Vec> = self - .slice - .iter() - .map(|v| v.to_shmem(builder)) - .collect(); + let values: Vec> = self.slice.iter().map(|v| v.to_shmem(builder)).collect(); // Create a new ThinArc with the shared value and have it place // its ArcInner in the shared memory buffer. @@ -499,10 +512,11 @@ impl ToShmem for SmallBitVec { let src = vs.as_ptr() as *const usize; ptr::copy(src, dest, len); - let dest_slice = Box::from_raw(slice::from_raw_parts_mut(dest, len) as *mut [usize]); + let dest_slice = + Box::from_raw(slice::from_raw_parts_mut(dest, len) as *mut [usize]); InternalStorage::Spilled(dest_slice) } - } + }, InternalStorage::Inline(x) => InternalStorage::Inline(x), }; ManuallyDrop::new(unsafe { SmallBitVec::from_storage(storage) }) -- cgit v1.2.3