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 {
233
233
} ,
234
234
}
235
235
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
+
236
242
impl From < LayoutErr > for CollectionAllocErr {
237
243
fn from ( _: LayoutErr ) -> Self {
238
244
CollectionAllocErr :: CapacityOverflow
@@ -1543,8 +1549,10 @@ where
1543
1549
where
1544
1550
B : SeqAccess < ' de > ,
1545
1551
{
1552
+ use serde:: de:: Error ;
1546
1553
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) ?;
1548
1556
1549
1557
while let Some ( value) = seq. next_element ( ) ? {
1550
1558
values. push ( value) ;
You can’t perform that action at this time.
0 commit comments