From 111894fef9cbd5c87b3e3508d0d983e1aedfe397 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 19 Sep 2020 20:40:20 +0900 Subject: util: remove Slice wrapper (#2847) --- tokio-util/tests/framed_read.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'tokio-util/tests') diff --git a/tokio-util/tests/framed_read.rs b/tokio-util/tests/framed_read.rs index da38c432..52c30ef9 100644 --- a/tokio-util/tests/framed_read.rs +++ b/tokio-util/tests/framed_read.rs @@ -185,8 +185,8 @@ fn read_partial_would_block_then_err() { #[test] fn huge_size() { let mut task = task::spawn(()); - let data = [0; 32 * 1024]; - let mut framed = FramedRead::new(Slice(&data[..]), BigDecoder); + let data = &[0; 32 * 1024][..]; + let mut framed = FramedRead::new(data, BigDecoder); task.enter(|cx, _| { assert_read!(pin!(framed).poll_next(cx), 0); @@ -212,7 +212,7 @@ fn huge_size() { #[test] fn data_remaining_is_error() { let mut task = task::spawn(()); - let slice = Slice(&[0; 5]); + let slice = &[0; 5][..]; let mut framed = FramedRead::new(slice, U32Decoder); task.enter(|cx, _| { @@ -280,16 +280,3 @@ impl AsyncRead for Mock { } } } - -// TODO this newtype is necessary because `&[u8]` does not currently implement `AsyncRead` -struct Slice<'a>(&'a [u8]); - -impl AsyncRead for Slice<'_> { - fn poll_read( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut ReadBuf<'_>, - ) -> Poll> { - Pin::new(&mut self.0).poll_read(cx, buf) - } -} -- cgit v1.2.3