From df30fe6701ba4b6df25660ded4d0161026cc37f6 Mon Sep 17 00:00:00 2001 From: Laurent Arnoud Date: Sat, 7 Mar 2020 20:37:44 +0100 Subject: [PATCH] Rename ErrorKind::HttpClient => ErrorKind::Http --- src/http/reqwest/sync_reqwest.rs | 4 ++-- src/model/errors.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/http/reqwest/sync_reqwest.rs b/src/http/reqwest/sync_reqwest.rs index a8e433490..7c23cebd1 100644 --- a/src/http/reqwest/sync_reqwest.rs +++ b/src/http/reqwest/sync_reqwest.rs @@ -15,9 +15,9 @@ impl RobotsTxtClient for Client { let url = Url::parse(&url).map_err(|err| RobotparserError {kind: ErrorKind::Url(err)})?; let mut request = Request::new(Method::GET, url); let _ = request.headers_mut().insert(USER_AGENT, HeaderValue::from_static(DEFAULT_USER_AGENT)); - let response = self.execute(request).map_err(|err| RobotparserError {kind: ErrorKind::HttpClient(err)})?; + let response = self.execute(request).map_err(|err| RobotparserError {kind: ErrorKind::Http(err)})?; let status_code = response.status().as_u16(); - let text = response.text().map_err(|err| RobotparserError {kind: ErrorKind::HttpClient(err)})?; + let text = response.text().map_err(|err| RobotparserError {kind: ErrorKind::Http(err)})?; let robots_txt = parse_fetched_robots_txt(origin, status_code, &text); return Ok(robots_txt); } diff --git a/src/model/errors.rs b/src/model/errors.rs index a0ef4a8da..37036495c 100644 --- a/src/model/errors.rs +++ b/src/model/errors.rs @@ -8,14 +8,14 @@ pub struct RobotparserError { #[derive(Debug)] pub enum ErrorKind { Url(url::ParseError), - HttpClient(reqwest::Error), + Http(reqwest::Error), } impl fmt::Display for RobotparserError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.kind { ErrorKind::Url(ref err) => err.fmt(f), - ErrorKind::HttpClient(ref err) => err.fmt(f), + ErrorKind::Http(ref err) => err.fmt(f), } } }