File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,12 @@ pub enum CollectionAllocErr {
233233 } ,
234234}
235235
236+ impl fmt:: Display for CollectionAllocErr {
237+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
238+ write ! ( f, "Allocation error: {:?}" , self )
239+ }
240+ }
241+
236242impl From < LayoutErr > for CollectionAllocErr {
237243 fn from ( _: LayoutErr ) -> Self {
238244 CollectionAllocErr :: CapacityOverflow
@@ -1543,8 +1549,10 @@ where
15431549 where
15441550 B : SeqAccess < ' de > ,
15451551 {
1552+ use serde:: de:: Error ;
15461553 let len = seq. size_hint ( ) . unwrap_or ( 0 ) ;
1547- let mut values = SmallVec :: with_capacity ( len) ;
1554+ let mut values = SmallVec :: new ( ) ;
1555+ values. try_reserve ( len) . map_err ( B :: Error :: custom) ?;
15481556
15491557 while let Some ( value) = seq. next_element ( ) ? {
15501558 values. push ( value) ;
You can’t perform that action at this time.
0 commit comments