Skip to content

Commit c32933d

Browse files
authored
Merge pull request #8 from messense/feature/from-response-mutability
Change from_response method signature
2 parents 96a6593 + 553b47f commit c32933d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl<'a> RobotFileParser<'a> {
248248
let client = Client::new();
249249
let request = client.get(self.url.clone())
250250
.header(UserAgent(USER_AGENT.to_owned()));
251-
let res = match request.send() {
251+
let mut res = match request.send() {
252252
Ok(res) => res,
253253
Err(_) => {
254254
return;
@@ -261,13 +261,13 @@ impl<'a> RobotFileParser<'a> {
261261
status if status >= StatusCode::BadRequest && status < StatusCode::InternalServerError => {
262262
self.allow_all.set(true);
263263
}
264-
StatusCode::Ok => self.from_response(res),
264+
StatusCode::Ok => self.from_response(&mut res),
265265
_ => {}
266266
}
267267
}
268268

269269
/// Reads the HTTP response and feeds it to the parser.
270-
pub fn from_response(&self, mut response: Response) {
270+
pub fn from_response(&self, response: &mut Response) {
271271
let mut buf = String::new();
272272
response.read_to_string(&mut buf).unwrap();
273273
let lines: Vec<&str> = buf.split('\n').collect();

0 commit comments

Comments
 (0)