@@ -1016,11 +1016,11 @@ fn test_try_reserve() {
1016
1016
} else { panic ! ( "usize::MAX should trigger an overflow!" ) }
1017
1017
} else {
1018
1018
// Check isize::MAX + 1 is an OOM
1019
- if let Err ( AllocErr ( _ ) ) = empty_bytes. try_reserve ( MAX_CAP + 1 ) {
1019
+ if let Err ( AllocErr ) = empty_bytes. try_reserve ( MAX_CAP + 1 ) {
1020
1020
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1021
1021
1022
1022
// Check usize::MAX is an OOM
1023
- if let Err ( AllocErr ( _ ) ) = empty_bytes. try_reserve ( MAX_USIZE ) {
1023
+ if let Err ( AllocErr ) = empty_bytes. try_reserve ( MAX_USIZE ) {
1024
1024
} else { panic ! ( "usize::MAX should trigger an OOM!" ) }
1025
1025
}
1026
1026
}
@@ -1040,7 +1040,7 @@ fn test_try_reserve() {
1040
1040
if let Err ( CapacityOverflow ) = ten_bytes. try_reserve ( MAX_CAP - 9 ) {
1041
1041
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1042
1042
} else {
1043
- if let Err ( AllocErr ( _ ) ) = ten_bytes. try_reserve ( MAX_CAP - 9 ) {
1043
+ if let Err ( AllocErr ) = ten_bytes. try_reserve ( MAX_CAP - 9 ) {
1044
1044
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1045
1045
}
1046
1046
// Should always overflow in the add-to-len
@@ -1063,7 +1063,7 @@ fn test_try_reserve() {
1063
1063
if let Err ( CapacityOverflow ) = ten_u32s. try_reserve ( MAX_CAP /4 - 9 ) {
1064
1064
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1065
1065
} else {
1066
- if let Err ( AllocErr ( _ ) ) = ten_u32s. try_reserve ( MAX_CAP /4 - 9 ) {
1066
+ if let Err ( AllocErr ) = ten_u32s. try_reserve ( MAX_CAP /4 - 9 ) {
1067
1067
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1068
1068
}
1069
1069
// Should fail in the mul-by-size
@@ -1103,10 +1103,10 @@ fn test_try_reserve_exact() {
1103
1103
if let Err ( CapacityOverflow ) = empty_bytes. try_reserve_exact ( MAX_USIZE ) {
1104
1104
} else { panic ! ( "usize::MAX should trigger an overflow!" ) }
1105
1105
} else {
1106
- if let Err ( AllocErr ( _ ) ) = empty_bytes. try_reserve_exact ( MAX_CAP + 1 ) {
1106
+ if let Err ( AllocErr ) = empty_bytes. try_reserve_exact ( MAX_CAP + 1 ) {
1107
1107
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1108
1108
1109
- if let Err ( AllocErr ( _ ) ) = empty_bytes. try_reserve_exact ( MAX_USIZE ) {
1109
+ if let Err ( AllocErr ) = empty_bytes. try_reserve_exact ( MAX_USIZE ) {
1110
1110
} else { panic ! ( "usize::MAX should trigger an OOM!" ) }
1111
1111
}
1112
1112
}
@@ -1125,7 +1125,7 @@ fn test_try_reserve_exact() {
1125
1125
if let Err ( CapacityOverflow ) = ten_bytes. try_reserve_exact ( MAX_CAP - 9 ) {
1126
1126
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1127
1127
} else {
1128
- if let Err ( AllocErr ( _ ) ) = ten_bytes. try_reserve_exact ( MAX_CAP - 9 ) {
1128
+ if let Err ( AllocErr ) = ten_bytes. try_reserve_exact ( MAX_CAP - 9 ) {
1129
1129
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1130
1130
}
1131
1131
if let Err ( CapacityOverflow ) = ten_bytes. try_reserve_exact ( MAX_USIZE ) {
@@ -1146,7 +1146,7 @@ fn test_try_reserve_exact() {
1146
1146
if let Err ( CapacityOverflow ) = ten_u32s. try_reserve_exact ( MAX_CAP /4 - 9 ) {
1147
1147
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1148
1148
} else {
1149
- if let Err ( AllocErr ( _ ) ) = ten_u32s. try_reserve_exact ( MAX_CAP /4 - 9 ) {
1149
+ if let Err ( AllocErr ) = ten_u32s. try_reserve_exact ( MAX_CAP /4 - 9 ) {
1150
1150
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1151
1151
}
1152
1152
if let Err ( CapacityOverflow ) = ten_u32s. try_reserve_exact ( MAX_USIZE - 20 ) {
0 commit comments