mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-16 08:58:26 +01:00
Fix unused OnceLock import lint on Windows
This commit is contained in:
parent
9f0fea6e21
commit
db9d2fa299
1 changed files with 4 additions and 4 deletions
|
@ -1,13 +1,9 @@
|
||||||
use crate::filesystem::absolute_path;
|
use crate::filesystem::absolute_path;
|
||||||
use std::fmt::{self, Formatter, Write};
|
use std::fmt::{self, Formatter, Write};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::OnceLock;
|
|
||||||
|
|
||||||
pub(crate) struct PathUrl(PathBuf);
|
pub(crate) struct PathUrl(PathBuf);
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
static HOSTNAME: OnceLock<String> = OnceLock::new();
|
|
||||||
|
|
||||||
impl PathUrl {
|
impl PathUrl {
|
||||||
pub(crate) fn new(path: &Path) -> Option<PathUrl> {
|
pub(crate) fn new(path: &Path) -> Option<PathUrl> {
|
||||||
Some(PathUrl(absolute_path(path).ok()?))
|
Some(PathUrl(absolute_path(path).ok()?))
|
||||||
|
@ -46,6 +42,10 @@ fn encode(f: &mut Formatter, byte: u8) -> fmt::Result {
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn host() -> &'static str {
|
fn host() -> &'static str {
|
||||||
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
|
static HOSTNAME: OnceLock<String> = OnceLock::new();
|
||||||
|
|
||||||
HOSTNAME
|
HOSTNAME
|
||||||
.get_or_init(|| {
|
.get_or_init(|| {
|
||||||
nix::unistd::gethostname()
|
nix::unistd::gethostname()
|
||||||
|
|
Loading…
Reference in a new issue