Fix a bunch of clippy lints

This commit is contained in:
Johannes Linke 2016-01-02 16:51:01 +01:00
parent b1ca3d1cdf
commit 6b215f38ee
58 changed files with 281 additions and 356 deletions

View file

@ -39,7 +39,7 @@ impl Cookie {
_ => (false, None)
};
let url_host = request.host().map(|host| host.serialize()).unwrap_or("".to_owned());
let url_host = request.host().map_or("".to_owned(), |host| host.serialize());
// Step 4
let mut domain = cookie.domain.clone().unwrap_or("".to_owned());

View file

@ -69,8 +69,8 @@ impl CookieStorage {
}
pub fn cookie_comparator(a: &Cookie, b: &Cookie) -> Ordering {
let a_path_len = a.cookie.path.as_ref().map(|p| p.len()).unwrap_or(0);
let b_path_len = b.cookie.path.as_ref().map(|p| p.len()).unwrap_or(0);
let a_path_len = a.cookie.path.as_ref().map_or(0, |p| p.len());
let b_path_len = b.cookie.path.as_ref().map_or(0, |p| p.len());
match a_path_len.cmp(&b_path_len) {
Ordering::Equal => {
let a_creation_time = a.creation_time.to_timespec();

View file

@ -178,7 +178,7 @@ pub trait HttpResponse: Read {
fn status(&self) -> StatusCode;
fn status_raw(&self) -> &RawStatus;
fn http_version(&self) -> String {
return "HTTP/1.1".to_owned()
"HTTP/1.1".to_owned()
}
fn content_encoding(&self) -> Option<Encoding> {
self.headers().get::<ContentEncoding>().and_then(|h| {
@ -295,11 +295,8 @@ impl HttpRequest for WrappedHttpRequest {
};
if let Some(ref data) = *body {
match request_writer.write_all(&data) {
Err(e) => {
return Err(LoadError::Connection(url, e.description().to_owned()))
}
_ => {}
if let Err(e) = request_writer.write_all(&data) {
return Err(LoadError::Connection(url, e.description().to_owned()))
}
}