@@ -1221,7 +1221,7 @@ impl<T, S: VecStorage<T> + ?Sized> Drop for VecInner<T, S> {
1221
1221
#[ cfg( feature = "alloc" ) ]
1222
1222
/// Converts the given `alloc::vec::Vec<T>` into a `Vec<T, N>`.
1223
1223
impl < T , const N : usize > TryFrom < alloc:: vec:: Vec < T > > for Vec < T , N > {
1224
- type Error = ( ) ;
1224
+ type Error = crate :: CapacityError ;
1225
1225
1226
1226
/// Converts the given `alloc::vec::Vec<T>` into a `Vec<T, N>`.
1227
1227
///
@@ -1233,7 +1233,7 @@ impl<T, const N: usize> TryFrom<alloc::vec::Vec<T>> for Vec<T, N> {
1233
1233
1234
1234
for e in alloc_vec {
1235
1235
// Push each element individually to allow handling capacity errors.
1236
- vec. push ( e) . map_err ( |_| ( ) ) ?;
1236
+ vec. push ( e) ?;
1237
1237
}
1238
1238
1239
1239
Ok ( vec)
@@ -1243,7 +1243,7 @@ impl<T, const N: usize> TryFrom<alloc::vec::Vec<T>> for Vec<T, N> {
1243
1243
#[ cfg( feature = "alloc" ) ]
1244
1244
/// Converts the given `Vec<T, N>` into an `alloc::vec::Vec<T>`.
1245
1245
impl < T , const N : usize > TryFrom < Vec < T , N > > for alloc:: vec:: Vec < T > {
1246
- type Error = ( ) ;
1246
+ type Error = alloc :: collections :: TryReserveError ;
1247
1247
1248
1248
/// Converts the given `Vec<T, N>` into an `alloc::vec::Vec<T>`.
1249
1249
///
@@ -1255,7 +1255,7 @@ impl<T, const N: usize> TryFrom<Vec<T, N>> for alloc::vec::Vec<T> {
1255
1255
1256
1256
// Allocate enough space for the elements, return an error if the
1257
1257
// allocation fails.
1258
- alloc_vec. try_reserve ( vec. len ( ) ) . map_err ( |_| ( ) ) ?;
1258
+ alloc_vec. try_reserve_exact ( vec. len ( ) ) ?;
1259
1259
1260
1260
// Transfer the elements, since we reserved enough space above, this
1261
1261
// should not fail due to OOM.
0 commit comments