mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-16 00:48:28 +01:00
Merge pull request #1596 from RossSmyth/WinLints
Fix up some lints on Windows
This commit is contained in:
commit
e9fe337921
2 changed files with 5 additions and 4 deletions
|
@ -75,6 +75,7 @@ pub struct Config {
|
||||||
pub ls_colors: Option<LsColors>,
|
pub ls_colors: Option<LsColors>,
|
||||||
|
|
||||||
/// Whether or not we are writing to an interactive terminal
|
/// Whether or not we are writing to an interactive terminal
|
||||||
|
#[cfg_attr(not(unix), allow(unused))]
|
||||||
pub interactive_terminal: bool,
|
pub interactive_terminal: bool,
|
||||||
|
|
||||||
/// The type of file to search for. If set to `None`, all file types are displayed. If
|
/// The type of file to search for. If set to `None`, all file types are displayed. If
|
||||||
|
|
|
@ -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