diff --git a/src/config.rs b/src/config.rs index 8cee778..9e18120 100644 --- a/src/config.rs +++ b/src/config.rs @@ -75,6 +75,7 @@ pub struct Config { pub ls_colors: Option, /// Whether or not we are writing to an interactive terminal + #[cfg_attr(not(unix), allow(unused))] pub interactive_terminal: bool, /// The type of file to search for. If set to `None`, all file types are displayed. If diff --git a/src/hyperlink.rs b/src/hyperlink.rs index d137194..4ddd3ef 100644 --- a/src/hyperlink.rs +++ b/src/hyperlink.rs @@ -1,13 +1,9 @@ use crate::filesystem::absolute_path; use std::fmt::{self, Formatter, Write}; use std::path::{Path, PathBuf}; -use std::sync::OnceLock; pub(crate) struct PathUrl(PathBuf); -#[cfg(unix)] -static HOSTNAME: OnceLock = OnceLock::new(); - impl PathUrl { pub(crate) fn new(path: &Path) -> Option { Some(PathUrl(absolute_path(path).ok()?)) @@ -46,6 +42,10 @@ fn encode(f: &mut Formatter, byte: u8) -> fmt::Result { #[cfg(unix)] fn host() -> &'static str { + use std::sync::OnceLock; + + static HOSTNAME: OnceLock = OnceLock::new(); + HOSTNAME .get_or_init(|| { nix::unistd::gethostname()