Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/stdx/src/thin_vec.rs')
| -rw-r--r-- | crates/stdx/src/thin_vec.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/crates/stdx/src/thin_vec.rs b/crates/stdx/src/thin_vec.rs index 700220e1d3..69d8ee7d90 100644 --- a/crates/stdx/src/thin_vec.rs +++ b/crates/stdx/src/thin_vec.rs @@ -1,9 +1,9 @@ -use std::alloc::{dealloc, handle_alloc_error, Layout}; +use std::alloc::{Layout, dealloc, handle_alloc_error}; use std::fmt; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; -use std::ptr::{addr_of_mut, slice_from_raw_parts_mut, NonNull}; +use std::ptr::{NonNull, addr_of_mut, slice_from_raw_parts_mut}; /// A type that is functionally equivalent to `(Header, Box<[Item]>)`, /// but all data is stored in one heap allocation and the pointer is thin, @@ -322,11 +322,7 @@ impl<T> EmptyOptimizedThinVec<T> { I::IntoIter: TrustedLen<Item = T>, { let values = values.into_iter(); - if values.len() == 0 { - Self::empty() - } else { - Self(Some(ThinVec::from_iter(values))) - } + if values.len() == 0 { Self::empty() } else { Self(Some(ThinVec::from_iter(values))) } } #[inline] |