mirror of
https://github.com/samsonjs/agate.git
synced 2026-03-25 09:05:50 +00:00
improve conditional compilation for unix
see also https://github.com/mbrubeck/agate/pull/274#issuecomment-1624453851
This commit is contained in:
parent
e3154aeb4d
commit
6dbafbcb50
1 changed files with 5 additions and 5 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -159,8 +159,7 @@ static ARGS: Lazy<Args> = Lazy::new(|| {
|
|||
|
||||
struct Args {
|
||||
addrs: Vec<SocketAddr>,
|
||||
// only used on unix, so dead code on windows
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
#[cfg(unix)]
|
||||
sockets: Vec<PathBuf>,
|
||||
content_dir: PathBuf,
|
||||
certs: Arc<certificates::CertStore>,
|
||||
|
|
@ -349,10 +348,10 @@ fn args() -> Result<Args> {
|
|||
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<Args> {
|
|||
|
||||
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<TcpStream> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(unix)]
|
||||
impl RequestHandle<UnixStream> {
|
||||
async fn new_unix(
|
||||
stream: UnixStream,
|
||||
|
|
|
|||
Loading…
Reference in a new issue