Make From only for static slices to Bytes

This commit is contained in:
Douman
2019-08-27 22:17:26 +02:00
parent b6cb346adf
commit ae9991f3ba
2 changed files with 16 additions and 11 deletions
+2 -2
View File
@@ -528,7 +528,7 @@ fn stress() {
for i in 0..ITERS {
let data = [i as u8; 256];
let buf = Arc::new(Bytes::from(&data[..]));
let buf = Arc::new(Bytes::copy_from_slice(&data[..]));
let barrier = Arc::new(Barrier::new(THREADS));
let mut joins = Vec::with_capacity(THREADS);
@@ -888,7 +888,7 @@ fn slice_ref_catches_not_an_empty_subset() {
#[test]
#[should_panic]
fn empty_slice_ref_catches_not_an_empty_subset() {
let bytes = Bytes::from(&b""[..]);
let bytes = Bytes::copy_from_slice(&b""[..]);
let slice = &b""[0..0];
bytes.slice_ref(slice);