Auto merge of #7938 - A-deLuna:remove-clone-from-respond_with_headers-fixes-#7922, r=Ms2ger

removed clone from respond_with_headers fixes #7922

fixes #7922 
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7938)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-10-09 11:40:33 -06:00
commit ec10b1708e

View file

@ -28,15 +28,15 @@ use url::Url;
const DEFAULT_USER_AGENT: &'static str = "Test-agent"; const DEFAULT_USER_AGENT: &'static str = "Test-agent";
fn respond_with(body: Vec<u8>) -> MockResponse { fn respond_with(body: Vec<u8>) -> MockResponse {
let mut headers = Headers::new(); let headers = Headers::new();
respond_with_headers(body, &mut headers) respond_with_headers(body, headers)
} }
fn respond_with_headers(body: Vec<u8>, headers: &mut Headers) -> MockResponse { fn respond_with_headers(body: Vec<u8>, mut headers: Headers) -> MockResponse {
headers.set(ContentLength(body.len() as u64)); headers.set(ContentLength(body.len() as u64));
MockResponse::new( MockResponse::new(
headers.clone(), headers,
StatusCode::Ok, StatusCode::Ok,
RawStatus(200, Cow::Borrowed("Ok")), RawStatus(200, Cow::Borrowed("Ok")),
body body
@ -118,8 +118,8 @@ fn response_for_request_type(t: ResponseType) -> Result<MockResponse, LoadError>
ResponseType::Text(b) => { ResponseType::Text(b) => {
Ok(respond_with(b)) Ok(respond_with(b))
}, },
ResponseType::WithHeaders(b, mut h) => { ResponseType::WithHeaders(b, h) => {
Ok(respond_with_headers(b, &mut h)) Ok(respond_with_headers(b, h))
} }
} }
} }