Auto merge of #7973 - creativcoder:fix_issue_7969, r=jdm

convert match to if let for location header check #7969

@jdm Hi, very eager for my first pull request to Servo. Please review the changes.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7973)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-10-12 03:13:28 -06:00
commit 8dff3be956

View file

@ -635,11 +635,9 @@ pub fn load<A>(load_data: LoadData,
// --- Loop if there's a redirect
if response.status().class() == StatusClass::Redirection {
match response.headers().get::<Location>() {
Some(&Location(ref new_url)) => {
if let Some(&Location(ref new_url)) = response.headers().get::<Location>() {
// CORS (https://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10)
match load_data.cors {
Some(ref c) => {
if let Some(ref c) = load_data.cors {
if c.preflight {
return Err(
LoadError::Cors(
@ -650,8 +648,6 @@ pub fn load<A>(load_data: LoadData,
// but they don't seem necessary until credentials are implemented
}
}
_ => {}
}
let new_doc_url = match UrlParser::new().base_url(&doc_url).parse(&new_url) {
Ok(u) => u,
@ -679,8 +675,6 @@ pub fn load<A>(load_data: LoadData,
redirected_to.insert(doc_url.clone());
continue;
}
None => ()
}
}
let mut adjusted_headers = response.headers().clone();