fix clippy

This commit is contained in:
quininer 2019-02-23 01:48:09 +08:00
parent 681cbe68ca
commit 163a96b062
4 changed files with 21 additions and 27 deletions

View File

@ -52,20 +52,17 @@ where IO: AsyncRead + AsyncWrite,
#[inline] #[inline]
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
match self { if let MidHandshake::Handshaking(stream) = self {
MidHandshake::Handshaking(stream) => { let (io, session) = stream.get_mut();
let (io, session) = stream.get_mut(); let mut stream = Stream::new(io, session);
let mut stream = Stream::new(io, session);
if stream.session.is_handshaking() { if stream.session.is_handshaking() {
try_nb!(stream.complete_io()); try_nb!(stream.complete_io());
} }
if stream.session.wants_write() { if stream.session.wants_write() {
try_nb!(stream.complete_io()); try_nb!(stream.complete_io());
} }
},
_ => ()
} }
match mem::replace(self, MidHandshake::End) { match mem::replace(self, MidHandshake::End) {

View File

@ -84,8 +84,8 @@ impl<'a, IO: AsyncRead + AsyncWrite, S: Session> WriteTls<'a, IO, S> for Stream<
} }
} }
let mut vecbuf = V(self.io); let mut vecio = V(self.io);
self.session.writev_tls(&mut vecbuf) self.session.writev_tls(&mut vecio)
} }
} }

View File

@ -48,7 +48,7 @@ impl<'a, 'b> Buf for VecBuf<'a, 'b> {
} }
} }
#[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))] #[allow(clippy::needless_range_loop)]
fn bytes_vec<'c>(&'c self, dst: &mut [&'c IoVec]) -> usize { fn bytes_vec<'c>(&'c self, dst: &mut [&'c IoVec]) -> usize {
let len = cmp::min(self.inner.len() - self.pos, dst.len()); let len = cmp::min(self.inner.len() - self.pos, dst.len());

View File

@ -48,20 +48,17 @@ where IO: AsyncRead + AsyncWrite,
#[inline] #[inline]
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
match self { if let MidHandshake::Handshaking(stream) = self {
MidHandshake::Handshaking(stream) => { let (io, session) = stream.get_mut();
let (io, session) = stream.get_mut(); let mut stream = Stream::new(io, session);
let mut stream = Stream::new(io, session);
if stream.session.is_handshaking() { if stream.session.is_handshaking() {
try_nb!(stream.complete_io()); try_nb!(stream.complete_io());
} }
if stream.session.wants_write() { if stream.session.wants_write() {
try_nb!(stream.complete_io()); try_nb!(stream.complete_io());
} }
},
_ => ()
} }
match mem::replace(self, MidHandshake::End) { match mem::replace(self, MidHandshake::End) {