Skip to content

Commit 846739e

Browse files
authored
Merge pull request #2823 from rbtcollins/lint
Fix lint on Windows
2 parents eaee3e7 + 79e3b69 commit 846739e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/utils/raw.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#[cfg(not(windows))]
12
use std::env;
23
use std::fs;
34
use std::io;
45
use std::io::Write;
56
use std::path::Path;
67
use std::str;
78

9+
#[cfg(not(windows))]
810
use crate::process;
911

1012
pub(crate) fn ensure_dir_exists<P: AsRef<Path>, F: FnOnce(&Path)>(
@@ -247,6 +249,7 @@ pub(crate) fn copy_dir(src: &Path, dest: &Path) -> io::Result<()> {
247249
Ok(())
248250
}
249251

252+
#[cfg(not(windows))]
250253
fn has_cmd(cmd: &str) -> bool {
251254
let cmd = format!("{}{}", cmd, env::consts::EXE_SUFFIX);
252255
let path = process().var_os("PATH").unwrap_or_default();
@@ -255,6 +258,7 @@ fn has_cmd(cmd: &str) -> bool {
255258
.any(|p| p.exists())
256259
}
257260

261+
#[cfg(not(windows))]
258262
pub(crate) fn find_cmd<'a>(cmds: &[&'a str]) -> Option<&'a str> {
259263
cmds.iter().cloned().find(|&s| has_cmd(s))
260264
}

src/utils/utils.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ use crate::utils::notifications::Notification;
1616
use crate::utils::raw;
1717
use crate::{home_process, process};
1818

19-
pub(crate) use crate::utils::utils::raw::{find_cmd, if_not_empty, is_directory};
19+
#[cfg(not(windows))]
20+
pub(crate) use crate::utils::utils::raw::find_cmd;
21+
pub(crate) use crate::utils::utils::raw::{if_not_empty, is_directory};
2022

2123
pub use crate::utils::utils::raw::{is_file, path_exists};
2224

@@ -423,6 +425,7 @@ pub(crate) fn open_browser(path: &Path) -> Result<()> {
423425
opener::open_browser(path).context("couldn't open browser")
424426
}
425427

428+
#[cfg(not(windows))]
426429
fn set_permissions(path: &Path, perms: fs::Permissions) -> Result<()> {
427430
fs::set_permissions(path, perms).map_err(|e| {
428431
RustupError::SettingPermissions {

0 commit comments

Comments
 (0)