From 553b47f7e74b9a6ce52790037b009d0a11e66d30 Mon Sep 17 00:00:00 2001 From: messense Date: Thu, 25 Aug 2016 18:01:17 +0800 Subject: [PATCH] Change from_response method signature --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8c31da0..d863b6a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -248,7 +248,7 @@ impl<'a> RobotFileParser<'a> { let client = Client::new(); let request = client.get(self.url.clone()) .header(UserAgent(USER_AGENT.to_owned())); - let res = match request.send() { + let mut res = match request.send() { Ok(res) => res, Err(_) => { return; @@ -261,13 +261,13 @@ impl<'a> RobotFileParser<'a> { status if status >= StatusCode::BadRequest && status < StatusCode::InternalServerError => { self.allow_all.set(true); } - StatusCode::Ok => self.from_response(res), + StatusCode::Ok => self.from_response(&mut res), _ => {} } } /// Reads the HTTP response and feeds it to the parser. - pub fn from_response(&self, mut response: Response) { + pub fn from_response(&self, response: &mut Response) { let mut buf = String::new(); response.read_to_string(&mut buf).unwrap(); let lines: Vec<&str> = buf.split('\n').collect();