@@ -26,9 +26,6 @@ extern crate alloc;
2626#[ cfg( not( feature = "std" ) ) ]
2727use alloc:: Vec ;
2828
29- #[ cfg( feature="heapsizeof" ) ]
30- extern crate heapsize;
31-
3229#[ cfg( feature = "serde" ) ]
3330extern crate serde;
3431
@@ -48,17 +45,13 @@ use std::ptr;
4845use std:: slice;
4946#[ cfg( feature = "std" ) ]
5047use std:: io;
51- #[ cfg( feature="heapsizeof" ) ]
52- use std:: os:: raw:: c_void;
5348#[ cfg( feature = "serde" ) ]
5449use serde:: ser:: { Serialize , Serializer , SerializeSeq } ;
5550#[ cfg( feature = "serde" ) ]
5651use serde:: de:: { Deserialize , Deserializer , SeqAccess , Visitor } ;
5752#[ cfg( feature = "serde" ) ]
5853use std:: marker:: PhantomData ;
5954
60- #[ cfg( feature="heapsizeof" ) ]
61- use heapsize:: { HeapSizeOf , heap_size_of} ;
6255use SmallVecData :: { Inline , Heap } ;
6356
6457/// Common operations implemented by both `Vec` and `SmallVec`.
@@ -688,20 +681,6 @@ impl<A: Array> SmallVec<A> where A::Item: Copy {
688681 }
689682}
690683
691- #[ cfg( feature="heapsizeof" ) ]
692- impl < A : Array > HeapSizeOf for SmallVec < A > where A :: Item : HeapSizeOf {
693- fn heap_size_of_children ( & self ) -> usize {
694- match self . data {
695- Inline { .. } => 0 ,
696- Heap { ptr, .. } => {
697- self . iter ( ) . fold (
698- unsafe { heap_size_of ( ptr as * const c_void ) } ,
699- |n, elem| n + elem. heap_size_of_children ( ) )
700- } ,
701- }
702- }
703- }
704-
705684impl < A : Array > ops:: Deref for SmallVec < A > {
706685 type Target = [ A :: Item ] ;
707686 #[ inline]
@@ -1134,11 +1113,6 @@ pub mod tests {
11341113 #[ cfg( not( feature = "std" ) ) ]
11351114 use alloc:: vec:: Vec ;
11361115
1137- #[ cfg( feature="heapsizeof" ) ]
1138- use heapsize:: HeapSizeOf ;
1139- #[ cfg( feature="heapsizeof" ) ]
1140- use std:: mem:: size_of;
1141-
11421116 // We heap allocate all these strings so that double frees will show up under valgrind.
11431117
11441118 #[ test]
@@ -1599,30 +1573,6 @@ pub mod tests {
15991573 assert_eq ! ( & SmallVec :: <[ u32 ; 2 ] >:: from_slice( & [ 1 , 2 , 3 ] [ ..] ) [ ..] , [ 1 , 2 , 3 ] ) ;
16001574 }
16011575
1602- #[ cfg( feature="heapsizeof" ) ]
1603- #[ test]
1604- fn test_heap_size_of_children ( ) {
1605- let mut vec = SmallVec :: < [ u32 ; 2 ] > :: new ( ) ;
1606- assert_eq ! ( vec. heap_size_of_children( ) , 0 ) ;
1607- vec. push ( 1 ) ;
1608- vec. push ( 2 ) ;
1609- assert_eq ! ( vec. heap_size_of_children( ) , 0 ) ;
1610- vec. push ( 3 ) ;
1611- assert_eq ! ( vec. heap_size_of_children( ) , 16 ) ;
1612-
1613- // Now check with reserved space
1614- let mut vec = SmallVec :: < [ u32 ; 2 ] > :: new ( ) ;
1615- vec. reserve ( 10 ) ; // Rounds up to 16
1616- assert_eq ! ( vec. heap_size_of_children( ) , 64 ) ;
1617-
1618- // Check with nested heap structures
1619- let mut vec = SmallVec :: < [ Vec < u32 > ; 2 ] > :: new ( ) ;
1620- vec. reserve ( 10 ) ;
1621- vec. push ( vec ! [ 2 , 3 , 4 ] ) ;
1622- assert_eq ! ( vec. heap_size_of_children( ) ,
1623- vec![ 2 , 3 , 4 ] . heap_size_of_children( ) + 16 * size_of:: <Vec <u32 >>( ) ) ;
1624- }
1625-
16261576 #[ test]
16271577 fn test_exact_size_iterator ( ) {
16281578 let mut vec = SmallVec :: < [ u32 ; 2 ] > :: from ( & [ 1 , 2 , 3 ] [ ..] ) ;
0 commit comments