Fix issues found by rust-clippy

This commit is contained in:
Corey Farwell 2015-10-12 19:40:48 -04:00
parent 6303126e0c
commit 20beaf5af3
23 changed files with 106 additions and 121 deletions

View file

@ -154,7 +154,7 @@ impl Cookie {
}
}
if self.cookie.secure && url.scheme != "https".to_owned() {
if self.cookie.secure && url.scheme != "https" {
return false;
}
if self.cookie.httponly && source == CookieSource::NonHTTP {

View file

@ -75,10 +75,9 @@ fn send_error(url: Url, err: String, start_chan: LoadConsumer) {
let mut metadata: Metadata = Metadata::default(url);
metadata.status = None;
match start_sending_opt(start_chan, metadata) {
Ok(p) => p.send(Done(Err(err))).unwrap(),
_ => {}
};
if let Ok(p) = start_sending_opt(start_chan, metadata) {
p.send(Done(Err(err))).unwrap();
}
}
enum ReadResult {
@ -157,8 +156,8 @@ pub trait HttpResponse: Read {
fn content_encoding(&self) -> Option<Encoding> {
self.headers().get::<ContentEncoding>().and_then(|h| {
match h {
&ContentEncoding(ref encodings) => {
match *h {
ContentEncoding(ref encodings) => {
if encodings.contains(&Encoding::Gzip) {
Some(Encoding::Gzip)
} else if encodings.contains(&Encoding::Deflate) {

View file

@ -173,7 +173,7 @@ impl ResourceChannelManager {
self.resource_manager.set_cookies_for_url(request, cookie_list, source)
}
ControlMsg::GetCookiesForUrl(url, consumer, source) => {
let ref cookie_jar = self.resource_manager.cookie_storage;
let cookie_jar = &self.resource_manager.cookie_storage;
let mut cookie_jar = cookie_jar.write().unwrap();
consumer.send(cookie_jar.cookies_for_url(&url, source)).unwrap();
}
@ -215,7 +215,7 @@ impl ResourceManager {
if let Ok(SetCookie(cookies)) = header {
for bare_cookie in cookies {
if let Some(cookie) = cookie::Cookie::new_wrapped(bare_cookie, &request, source) {
let ref cookie_jar = self.cookie_storage;
let cookie_jar = &self.cookie_storage;
let mut cookie_jar = cookie_jar.write().unwrap();
cookie_jar.push(cookie, source);
}