We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28fb0f4 commit d1394a0Copy full SHA for d1394a0
src/lib.rs
@@ -233,6 +233,12 @@ pub enum CollectionAllocErr {
233
},
234
}
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
+
242
impl From<LayoutErr> for CollectionAllocErr {
243
fn from(_: LayoutErr) -> Self {
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
1557
while let Some(value) = seq.next_element()? {
1558
values.push(value);
0 commit comments