From 684391e44435044a7bfbb4fd6bcd70aa203a473b Mon Sep 17 00:00:00 2001 From: Toothbrush Date: Tue, 29 Jun 2021 17:19:14 +0100 Subject: [PATCH] Change `if cfg!(..) { }` to `#[cfg!(..)] { }` This fixes builds on non-Windows platforms. --- crates/cargo-util/src/paths.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/cargo-util/src/paths.rs b/crates/cargo-util/src/paths.rs index 02d7e3643..746ab24f1 100644 --- a/crates/cargo-util/src/paths.rs +++ b/crates/cargo-util/src/paths.rs @@ -679,7 +679,8 @@ fn exclude_from_backups(path: &Path) { /// /// This is currently a no-op on non-Windows platforms. fn exclude_from_content_indexing(path: &Path) { - if cfg!(windows) { + #[cfg(windows)] + { use std::iter::once; use std::os::windows::prelude::OsStrExt; use winapi::um::fileapi::{GetFileAttributesW, SetFileAttributesW}; @@ -692,7 +693,9 @@ fn exclude_from_content_indexing(path: &Path) { GetFileAttributesW(path.as_ptr()) | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED ); } - } else { + } + #[cfg(not(windows))] + { let _ = path; } }