style(lib): address most clippy lints

This commit is contained in:
danieleades
2020-01-03 17:40:32 +00:00
committed by Sean McArthur
parent 0f13719873
commit 0eaf304644
29 changed files with 162 additions and 200 deletions

View File

@@ -34,10 +34,7 @@ impl<T: Buf> Buf for BufList<T> {
#[inline]
fn bytes(&self) -> &[u8] {
for buf in &self.bufs {
return buf.bytes();
}
&[]
self.bufs.front().map(Buf::bytes).unwrap_or_default()
}
#[inline]

View File

@@ -58,11 +58,11 @@ where
) -> Poll<io::Result<usize>> {
if let Some(mut prefix) = self.pre.take() {
// If there are no remaining bytes, let the bytes get dropped.
if prefix.len() > 0 {
if !prefix.is_empty() {
let copy_len = cmp::min(prefix.len(), buf.len());
prefix.copy_to_slice(&mut buf[..copy_len]);
// Put back whats left
if prefix.len() > 0 {
if !prefix.is_empty() {
self.pre = Some(prefix);
}

View File

@@ -49,9 +49,8 @@ where
type Output = R::Output;
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
match self.inner {
Inner::Fut(ref mut f) => return Pin::new(f).poll(cx),
_ => (),
if let Inner::Fut(ref mut f) = self.inner {
return Pin::new(f).poll(cx);
}
match mem::replace(&mut self.inner, Inner::Empty) {