Merge pull request #1596 from RossSmyth/WinLints

Fix up some lints on Windows
This commit is contained in:
Thayne McCombs 2024-08-07 23:16:56 -06:00 committed by GitHub
commit e9fe337921
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -75,6 +75,7 @@ pub struct Config {
pub ls_colors: Option<LsColors>,
/// 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

View file

@ -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<String> = OnceLock::new();
impl PathUrl {
pub(crate) fn new(path: &Path) -> Option<PathUrl> {
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<String> = OnceLock::new();
HOSTNAME
.get_or_init(|| {
nix::unistd::gethostname()