From e4ad3a5e5f82a2c339a7e36b0b2549da75cbaa8e Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Wed, 1 Jul 2020 00:40:47 -0700 Subject: [PATCH] Remove unnecessary lifetime annotations. (#103) --- src/request.rs | 6 +++--- src/response.rs | 6 +++--- src/unit.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/request.rs b/src/request.rs index 59e60b3..b588017 100644 --- a/src/request.rs +++ b/src/request.rs @@ -260,7 +260,7 @@ impl Request { /// .build(); /// assert_eq!("foobar", req.header("x-api-Key").unwrap()); /// ``` - pub fn header<'a>(&self, name: &'a str) -> Option<&str> { + pub fn header(&self, name: &str) -> Option<&str> { header::get_header(&self.headers, name) } @@ -288,7 +288,7 @@ impl Request { /// .build(); /// assert_eq!(true, req.has("x-api-Key")); /// ``` - pub fn has<'a>(&self, name: &'a str) -> bool { + pub fn has(&self, name: &str) -> bool { header::has_header(&self.headers, name) } @@ -304,7 +304,7 @@ impl Request { /// "2.3.4.5", /// ]); /// ``` - pub fn all<'a>(&self, name: &'a str) -> Vec<&str> { + pub fn all(&self, name: &str) -> Vec<&str> { header::get_all_headers(&self.headers, name) } diff --git a/src/response.rs b/src/response.rs index 3e52ead..571bba2 100644 --- a/src/response.rs +++ b/src/response.rs @@ -122,7 +122,7 @@ impl Response { } /// The header corresponding header value for the give name, if any. - pub fn header<'a>(&self, name: &'a str) -> Option<&str> { + pub fn header(&self, name: &str) -> Option<&str> { self.headers .iter() .find(|h| h.is_name(name)) @@ -139,12 +139,12 @@ impl Response { } /// Tells if the response has the named header. - pub fn has<'a>(&self, name: &'a str) -> bool { + pub fn has(&self, name: &str) -> bool { self.header(name).is_some() } /// All headers corresponding values for the give name, or empty vector. - pub fn all<'a>(&self, name: &'a str) -> Vec<&str> { + pub fn all(&self, name: &str) -> Vec<&str> { self.headers .iter() .filter(|h| h.is_name(name)) diff --git a/src/unit.rs b/src/unit.rs index b6fd18b..e28c404 100644 --- a/src/unit.rs +++ b/src/unit.rs @@ -116,15 +116,15 @@ impl Unit { } #[cfg(test)] - pub fn header<'a>(&self, name: &'a str) -> Option<&str> { + pub fn header(&self, name: &str) -> Option<&str> { header::get_header(&self.headers, name) } #[cfg(test)] - pub fn has<'a>(&self, name: &'a str) -> bool { + pub fn has(&self, name: &str) -> bool { header::has_header(&self.headers, name) } #[cfg(test)] - pub fn all<'a>(&self, name: &'a str) -> Vec<&str> { + pub fn all(&self, name: &str) -> Vec<&str> { header::get_all_headers(&self.headers, name) } } @@ -250,7 +250,7 @@ fn extract_cookies(_state: &std::sync::Mutex>, _url: &Url) -> // TODO check so cookies can't be set for tld:s #[cfg(feature = "cookie")] -fn match_cookies<'a>(jar: &'a CookieJar, domain: &str, path: &str, is_secure: bool) -> Vec
{ +fn match_cookies(jar: &CookieJar, domain: &str, path: &str, is_secure: bool) -> Vec
{ jar.iter() .filter(|c| { // if there is a domain, it must be matched.