style(all): Address suggestions made by rust-clippy

This commit is contained in:
Corey Farwell
2015-12-22 23:26:16 -08:00
parent 7d4db58c8c
commit 4c7f6f0c1e
14 changed files with 39 additions and 38 deletions

View File

@@ -171,8 +171,8 @@ impl HttpMessage for Http11Message {
}
}
};
match &head.method {
&Method::Get | &Method::Head => {
match head.method {
Method::Get | Method::Head => {
let writer = match write_headers(stream, &head) {
Ok(w) => w,
Err(e) => {
@@ -734,7 +734,7 @@ impl<W: Write> HttpWriter<W> {
/// Access the inner Writer.
#[inline]
pub fn get_ref<'a>(&'a self) -> &'a W {
pub fn get_ref(&self) -> &W {
match *self {
ThroughWriter(ref w) => w,
ChunkedWriter(ref w) => w,
@@ -748,7 +748,7 @@ impl<W: Write> HttpWriter<W> {
/// Warning: You should not write to this directly, as you can corrupt
/// the state.
#[inline]
pub fn get_mut<'a>(&'a mut self) -> &'a mut W {
pub fn get_mut(&mut self) -> &mut W {
match *self {
ThroughWriter(ref mut w) => w,
ChunkedWriter(ref mut w) => w,

View File

@@ -302,7 +302,7 @@ fn prepare_headers(mut headers: Headers) -> Vec<Http2Header> {
/// A helper function that prepares the body for sending in an HTTP/2 request.
#[inline]
fn prepare_body(body: Vec<u8>) -> Option<Vec<u8>> {
if body.len() == 0 {
if body.is_empty() {
None
} else {
Some(body)
@@ -322,7 +322,7 @@ fn parse_headers(http2_headers: Vec<Http2Header>) -> ::Result<Headers> {
}
let mut raw_headers = Vec::new();
for &(ref name, ref value) in headers.iter() {
for &(ref name, ref value) in &headers {
raw_headers.push(httparse::Header { name: &name, value: &value });
}