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 authored and Martin Algesten committed 2020-09-14 08:58:02 +02:00
1 parent b8b67a41a9
commit c343587afb
2 files changed
+3

No files matched your search

+1
View File
@@ -100,6 +100,7 @@ fn connection_reuse() {
assert_eq!(resp.status(), 200);
}
#[cfg(feature = "cookie")]
#[cfg(test)]
fn cookie_and_redirect(mut stream: TcpStream) -> io::Result<()> {
let headers = read_headers(&stream);
+2
View File
@@ -13,6 +13,7 @@ pub struct TestHeaders(Vec<String>);
impl TestHeaders {
// Return the path for a request, e.g. /foo from "GET /foo HTTP/1.1"
#[cfg(feature = "cookie")]
pub fn path(&self) -> &str {
if self.0.len() == 0 {
""
@@ -21,6 +22,7 @@ impl TestHeaders {
}
}
#[cfg(feature = "cookie")]
pub fn headers(&self) -> &[String] {
&self.0[1..]
}