ci: enable clippy lints (#1335)

This commit is contained in:
Taiki Endo
2019-07-26 03:47:14 +09:00
committed by GitHub
parent f311ac3d4f
commit fe021e6c00
54 changed files with 394 additions and 274 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ use bytes::{BufMut, Bytes, BytesMut};
use std::io;
/// A simple `Codec` implementation that just ships bytes around.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Default)]
pub struct BytesCodec(());
impl BytesCodec {
@@ -19,7 +19,7 @@ impl Decoder for BytesCodec {
type Error = io::Error;
fn decode(&mut self, buf: &mut BytesMut) -> Result<Option<BytesMut>, io::Error> {
if buf.len() > 0 {
if !buf.is_empty() {
let len = buf.len();
Ok(Some(buf.split_to(len)))
} else {
+1 -1
View File
@@ -153,7 +153,7 @@ pub fn framed_read2_with_buffer<T>(inner: T, mut buf: BytesMut) -> FramedRead2<T
FramedRead2 {
inner,
eof: false,
is_readable: buf.len() > 0,
is_readable: !buf.is_empty(),
buffer: buf,
}
}
+6
View File
@@ -190,6 +190,12 @@ impl Encoder for LinesCodec {
}
}
impl Default for LinesCodec {
fn default() -> Self {
Self::new()
}
}
/// An error occured while encoding or decoding a line.
#[derive(Debug)]
pub enum LinesCodecError {