diff options
author | Taiki Endo <te316e89@gmail.com> | 2020-09-19 20:40:20 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 20:40:20 +0900 |
commit | 111894fef9cbd5c87b3e3508d0d983e1aedfe397 (patch) | |
tree | 006466e24288c46afa034ff8d5debfa8e2beec3c /tokio-util | |
parent | 68f7eff39e5adf2246770d7239ed83731297d1f3 (diff) |
util: remove Slice wrapper (#2847)
Diffstat (limited to 'tokio-util')
-rw-r--r-- | tokio-util/tests/framed_read.rs | 19 |
1 files changed, 3 insertions, 16 deletions
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<io::Result<()>> { - Pin::new(&mut self.0).poll_read(cx, buf) - } -} |