Remove unnecessary lifetime annotations. (#103)

This commit is contained in:
Jacob Hoffman-Andrews
2020-07-01 00:40:47 -07:00
committed by GitHub
parent bbde617719
commit e4ad3a5e5f
3 changed files with 10 additions and 10 deletions

View File

@@ -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)
}

View File

@@ -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))

View File

@@ -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<Option<AgentState>>, _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<Header> {
fn match_cookies(jar: &CookieJar, domain: &str, path: &str, is_secure: bool) -> Vec<Header> {
jar.iter()
.filter(|c| {
// if there is a domain, it must be matched.