aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-01-10 15:32:11 +0000
committerSven-Hendrik Haase <svenstaro@gmail.com>2025-01-10 15:32:11 +0000
commit996ac309ab33aea63dbcd762f2c85e6836d73c5f (patch)
tree8d6e20eb912ff892caf14c78684ca84987b8327a
parentBump deps (diff)
downloadminiserve-996ac309ab33aea63dbcd762f2c85e6836d73c5f.tar.gz
miniserve-996ac309ab33aea63dbcd762f2c85e6836d73c5f.zip
Remove some unnecessary #[allow(dead_code)]
-rw-r--r--tests/fixtures/mod.rs10
-rw-r--r--tests/utils/mod.rs4
2 files changed, 2 insertions, 12 deletions
diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs
index 96b8002..f5231f7 100644
--- a/tests/fixtures/mod.rs
+++ b/tests/fixtures/mod.rs
@@ -12,7 +12,6 @@ use std::time::{Duration, Instant};
pub type Error = Box<dyn std::error::Error>;
/// File names for testing purpose
-#[allow(dead_code)]
pub static FILES: &[&str] = &[
"test.txt",
"test.html",
@@ -31,25 +30,20 @@ pub static FILES: &[&str] = &[
];
/// Hidden files for testing purpose
-#[allow(dead_code)]
pub static HIDDEN_FILES: &[&str] = &[".hidden_file1", ".hidden_file2"];
/// Directory names for testing purpose
-#[allow(dead_code)]
pub static DIRECTORIES: &[&str] = &["dira/", "dirb/", "dirc/"];
/// Hidden directories for testing purpose
-#[allow(dead_code)]
pub static HIDDEN_DIRECTORIES: &[&str] = &[".hidden_dir1/", ".hidden_dir2/"];
/// Name of a deeply nested file
-#[allow(dead_code)]
pub static DEEPLY_NESTED_FILE: &str = "very/deeply/nested/test.rs";
/// Test fixture which creates a temporary directory with a few files and directories inside.
/// The directories also contain files.
#[fixture]
-#[allow(dead_code)]
pub fn tmpdir() -> TempDir {
let tmpdir = assert_fs::TempDir::new().expect("Couldn't create a temp dir for tests");
let mut files = FILES.to_vec();
@@ -81,7 +75,6 @@ pub fn tmpdir() -> TempDir {
/// Get a free port.
#[fixture]
-#[allow(dead_code)]
pub fn port() -> u16 {
free_local_port().expect("Couldn't find a free local port")
}
@@ -89,7 +82,6 @@ pub fn port() -> u16 {
/// Run miniserve as a server; Start with a temporary directory, a free port and some
/// optional arguments then wait for a while for the server setup to complete.
#[fixture]
-#[allow(dead_code)]
pub fn server<I>(#[default(&[] as &[&str])] args: I) -> TestServer
where
I: IntoIterator + Clone,
@@ -116,7 +108,6 @@ where
/// Same as `server()` but ignore stderr
#[fixture]
-#[allow(dead_code)]
pub fn server_no_stderr<I>(#[default(&[] as &[&str])] args: I) -> TestServer
where
I: IntoIterator + Clone,
@@ -155,7 +146,6 @@ fn wait_for_port(port: u16) {
}
}
-#[allow(dead_code)]
pub struct TestServer {
port: u16,
tmpdir: TempDir,
diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs
index ac90bff..c392b14 100644
--- a/tests/utils/mod.rs
+++ b/tests/utils/mod.rs
@@ -1,11 +1,10 @@
-#![allow(dead_code)]
-
use select::document::Document;
use select::node::Node;
use select::predicate::Name;
use select::predicate::Predicate;
/// Return the href attribute content for the closest anchor found by `text`.
+#[allow(dead_code)]
pub fn get_link_from_text(document: &Document, text: &str) -> Option<String> {
let a_elem = document
.find(Name("a").and(|x: &Node| x.children().any(|x| x.text() == text)))
@@ -14,6 +13,7 @@ pub fn get_link_from_text(document: &Document, text: &str) -> Option<String> {
}
/// Return the href attributes of all links that start with the specified `prefix`.
+#[allow(dead_code)]
pub fn get_link_hrefs_with_prefix(document: &Document, prefix: &str) -> Vec<String> {
let mut vec: Vec<String> = Vec::new();