diff --git a/src/main.rs b/src/main.rs index 5f57565..6a49c0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -159,8 +159,7 @@ static ARGS: Lazy = Lazy::new(|| { struct Args { addrs: Vec, - // only used on unix, so dead code on windows - #[cfg_attr(windows, allow(dead_code))] + #[cfg(unix)] sockets: Vec, content_dir: PathBuf, certs: Arc, @@ -349,10 +348,10 @@ fn args() -> Result { addrs.push(i.parse()?); } - #[allow(unused_mut)] // only used on unix + #[cfg_attr(not(unix), allow(unused_mut))] let mut empty = addrs.is_empty(); - #[allow(unused_mut)] // only used on unix + #[cfg(unix)] let mut sockets = vec![]; #[cfg(unix)] { @@ -372,6 +371,7 @@ fn args() -> Result { Ok(Args { addrs, + #[cfg(unix)] sockets, content_dir: check_path(matches.opt_get_default("content", "content".into())?)?, certs: Arc::new(certs), @@ -463,7 +463,7 @@ impl RequestHandle { } } -#[cfg(target_family = "unix")] +#[cfg(unix)] impl RequestHandle { async fn new_unix( stream: UnixStream,