@@ -681,8 +681,8 @@ impl<'de> Visitor<'de> for CStringVisitor {
681
681
where
682
682
A : SeqAccess < ' de > ,
683
683
{
684
- let len = size_hint:: cautious ( seq. size_hint ( ) ) ;
685
- let mut values = Vec :: with_capacity ( len ) ;
684
+ let capacity = size_hint:: cautious :: < u8 > ( seq. size_hint ( ) ) ;
685
+ let mut values = Vec :: < u8 > :: with_capacity ( capacity ) ;
686
686
687
687
while let Some ( value) = try!( seq. next_element ( ) ) {
688
688
values. push ( value) ;
@@ -936,7 +936,7 @@ macro_rules! seq_impl {
936
936
A : SeqAccess <' de>,
937
937
{
938
938
$clear( & mut self . 0 ) ;
939
- $reserve( & mut self . 0 , size_hint:: cautious( $access. size_hint( ) ) ) ;
939
+ $reserve( & mut self . 0 , size_hint:: cautious:: < T > ( $access. size_hint( ) ) ) ;
940
940
941
941
// FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList)
942
942
while let Some ( value) = try!( $access. next_element( ) ) {
@@ -962,7 +962,7 @@ seq_impl!(
962
962
BinaryHeap <T : Ord >,
963
963
seq,
964
964
BinaryHeap :: clear,
965
- BinaryHeap :: with_capacity( size_hint:: cautious( seq. size_hint( ) ) ) ,
965
+ BinaryHeap :: with_capacity( size_hint:: cautious:: < T > ( seq. size_hint( ) ) ) ,
966
966
BinaryHeap :: reserve,
967
967
BinaryHeap :: push
968
968
) ;
@@ -992,7 +992,7 @@ seq_impl!(
992
992
HashSet <T : Eq + Hash , S : BuildHasher + Default >,
993
993
seq,
994
994
HashSet :: clear,
995
- HashSet :: with_capacity_and_hasher( size_hint:: cautious( seq. size_hint( ) ) , S :: default ( ) ) ,
995
+ HashSet :: with_capacity_and_hasher( size_hint:: cautious:: < T > ( seq. size_hint( ) ) , S :: default ( ) ) ,
996
996
HashSet :: reserve,
997
997
HashSet :: insert
998
998
) ;
@@ -1002,7 +1002,7 @@ seq_impl!(
1002
1002
VecDeque <T >,
1003
1003
seq,
1004
1004
VecDeque :: clear,
1005
- VecDeque :: with_capacity( size_hint:: cautious( seq. size_hint( ) ) ) ,
1005
+ VecDeque :: with_capacity( size_hint:: cautious:: < T > ( seq. size_hint( ) ) ) ,
1006
1006
VecDeque :: reserve,
1007
1007
VecDeque :: push_back
1008
1008
) ;
@@ -1036,7 +1036,8 @@ where
1036
1036
where
1037
1037
A : SeqAccess < ' de > ,
1038
1038
{
1039
- let mut values = Vec :: with_capacity ( size_hint:: cautious ( seq. size_hint ( ) ) ) ;
1039
+ let capacity = size_hint:: cautious :: < T > ( seq. size_hint ( ) ) ;
1040
+ let mut values = Vec :: < T > :: with_capacity ( capacity) ;
1040
1041
1041
1042
while let Some ( value) = try!( seq. next_element ( ) ) {
1042
1043
values. push ( value) ;
@@ -1072,7 +1073,7 @@ where
1072
1073
where
1073
1074
A : SeqAccess < ' de > ,
1074
1075
{
1075
- let hint = size_hint:: cautious ( seq. size_hint ( ) ) ;
1076
+ let hint = size_hint:: cautious :: < T > ( seq. size_hint ( ) ) ;
1076
1077
if let Some ( additional) = hint. checked_sub ( self . 0 . len ( ) ) {
1077
1078
self . 0 . reserve ( additional) ;
1078
1079
}
@@ -1416,7 +1417,7 @@ map_impl!(BTreeMap<K: Ord, V>, map, BTreeMap::new());
1416
1417
map_impl ! (
1417
1418
HashMap <K : Eq + Hash , V , S : BuildHasher + Default >,
1418
1419
map,
1419
- HashMap :: with_capacity_and_hasher( size_hint:: cautious( map. size_hint( ) ) , S :: default ( ) )
1420
+ HashMap :: with_capacity_and_hasher( size_hint:: cautious:: < ( K , V ) > ( map. size_hint( ) ) , S :: default ( ) )
1420
1421
) ;
1421
1422
1422
1423
////////////////////////////////////////////////////////////////////////////////
0 commit comments