File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -1265,6 +1265,8 @@ impl BytesMut {
1265
1265
///
1266
1266
/// Panics if `at > len`.
1267
1267
pub fn split_to ( & mut self , at : usize ) -> BytesMut {
1268
+ assert ! ( at <= self . len( ) ) ;
1269
+
1268
1270
BytesMut {
1269
1271
inner : self . inner . split_to ( at) ,
1270
1272
}
Original file line number Diff line number Diff line change @@ -258,15 +258,10 @@ fn split_to_oob_mut() {
258
258
}
259
259
260
260
#[ test]
261
+ #[ should_panic]
261
262
fn split_to_uninitialized ( ) {
262
263
let mut bytes = BytesMut :: with_capacity ( 1024 ) ;
263
- let other = bytes. split_to ( 128 ) ;
264
-
265
- assert_eq ! ( bytes. len( ) , 0 ) ;
266
- assert_eq ! ( bytes. capacity( ) , 896 ) ;
267
-
268
- assert_eq ! ( other. len( ) , 0 ) ;
269
- assert_eq ! ( other. capacity( ) , 128 ) ;
264
+ let _other = bytes. split_to ( 128 ) ;
270
265
}
271
266
272
267
#[ test]
You can’t perform that action at this time.
0 commit comments