Use #[cfg(feature = "cookie")] for some functions.

Some helper functions introduced as part of the cookies_on_redirect
test are only used by that test, which means they are only used when the
cookie feature is enabled. This causes clippy warnings for some of the
other feature combinations in CI.
This commit is contained in:
Jacob Hoffman-Andrews
2020-09-13 22:23:06 -07:00
committed by Martin Algesten
parent b8b67a41a9
commit c343587afb
2 changed files with 3 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ fn connection_reuse() {
assert_eq!(resp.status(), 200); assert_eq!(resp.status(), 200);
} }
#[cfg(feature = "cookie")]
#[cfg(test)] #[cfg(test)]
fn cookie_and_redirect(mut stream: TcpStream) -> io::Result<()> { fn cookie_and_redirect(mut stream: TcpStream) -> io::Result<()> {
let headers = read_headers(&stream); let headers = read_headers(&stream);

View File

@@ -13,6 +13,7 @@ pub struct TestHeaders(Vec<String>);
impl TestHeaders { impl TestHeaders {
// Return the path for a request, e.g. /foo from "GET /foo HTTP/1.1" // Return the path for a request, e.g. /foo from "GET /foo HTTP/1.1"
#[cfg(feature = "cookie")]
pub fn path(&self) -> &str { pub fn path(&self) -> &str {
if self.0.len() == 0 { if self.0.len() == 0 {
"" ""
@@ -21,6 +22,7 @@ impl TestHeaders {
} }
} }
#[cfg(feature = "cookie")]
pub fn headers(&self) -> &[String] { pub fn headers(&self) -> &[String] {
&self.0[1..] &self.0[1..]
} }