Fix unused OnceLock import lint on Windows

This commit is contained in:
Ross Smyth 2024-07-22 10:02:05 -04:00
parent 9f0fea6e21
commit db9d2fa299

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()