diff --git a/protocol/src/protocol/mod.rs b/protocol/src/protocol/mod.rs index 1bc06d2..25734cf 100644 --- a/protocol/src/protocol/mod.rs +++ b/protocol/src/protocol/mod.rs @@ -353,7 +353,7 @@ pub struct LenPrefixed { impl LenPrefixed { fn new(data: Vec) -> LenPrefixed { - return LenPrefixed { + LenPrefixed { len: Default::default(), data: data, } @@ -374,7 +374,7 @@ impl Serializable for LenPrefixed { fn write_to(&self, buf: &mut io::Write) -> Result<(), io::Error> { let len_data : L = L::from(self.data.len()); try!(len_data.write_to(buf)); - let ref data = self.data; + let data = &self.data; for val in data { try!(val.write_to(buf)); } @@ -406,7 +406,7 @@ pub struct LenPrefixedBytes { impl LenPrefixedBytes { fn new(data: Vec) -> LenPrefixedBytes { - return LenPrefixedBytes { + LenPrefixedBytes { len: Default::default(), data: data, } @@ -621,18 +621,18 @@ impl convert::From for Error { impl ::std::error::Error for Error { fn description(&self) -> &str { - match self { - &Error::Err(ref val) => &val[..], - &Error::IOError(ref e) => e.description(), + match *self { + Error::Err(ref val) => &val[..], + Error::IOError(ref e) => e.description(), } } } impl ::std::fmt::Display for Error { fn fmt(&self, f : &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - match self { - &Error::Err(ref val) => write!(f, "protocol error: {}", val), - &Error::IOError(ref e) => e.fmt(f) + match *self { + Error::Err(ref val) => write!(f, "protocol error: {}", val), + Error::IOError(ref e) => e.fmt(f) } } }