Remove a bunch of (hopefully) unnecessary Pins.
I believe these were introduced previously to solve a problem that we're no longer dealing with; specifically, if I remember correctly, we introduced these to deal with how we were going to implement a trait. However, they don't appear to be necessary any more, so we're going to get rid of them, so we won't need to deal with them any longer.
This commit is contained in:
@@ -10,7 +10,6 @@ use futures::io::Cursor;
|
||||
use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
#[cfg(test)]
|
||||
use quickcheck::{quickcheck, Arbitrary, Gen};
|
||||
use std::pin::Pin;
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct ServerChoice {
|
||||
@@ -19,7 +18,7 @@ pub struct ServerChoice {
|
||||
|
||||
impl ServerChoice {
|
||||
pub async fn read<R: AsyncRead + Send + Unpin>(
|
||||
mut r: Pin<&mut R>,
|
||||
r: &mut R,
|
||||
) -> Result<Self, DeserializationError> {
|
||||
let mut buffer = [0; 1];
|
||||
|
||||
@@ -60,12 +59,12 @@ standard_roundtrip!(server_choice_roundtrips, ServerChoice);
|
||||
fn check_short_reads() {
|
||||
let empty = vec![];
|
||||
let mut cursor = Cursor::new(empty);
|
||||
let ys = ServerChoice::read(Pin::new(&mut cursor));
|
||||
let ys = ServerChoice::read(&mut cursor);
|
||||
assert_eq!(Err(DeserializationError::NotEnoughData), task::block_on(ys));
|
||||
|
||||
let bad_len = vec![5];
|
||||
let mut cursor = Cursor::new(bad_len);
|
||||
let ys = ServerChoice::read(Pin::new(&mut cursor));
|
||||
let ys = ServerChoice::read(&mut cursor);
|
||||
assert_eq!(
|
||||
Err(DeserializationError::AuthenticationMethodError(
|
||||
AuthenticationDeserializationError::NoDataFound
|
||||
@@ -78,7 +77,7 @@ fn check_short_reads() {
|
||||
fn check_bad_version() {
|
||||
let no_len = vec![9, 1];
|
||||
let mut cursor = Cursor::new(no_len);
|
||||
let ys = ServerChoice::read(Pin::new(&mut cursor));
|
||||
let ys = ServerChoice::read(&mut cursor);
|
||||
assert_eq!(
|
||||
Err(DeserializationError::InvalidVersion(5, 9)),
|
||||
task::block_on(ys)
|
||||
|
||||
Reference in New Issue
Block a user