Skip to content

Commit e99c681

Browse files
authored
Clean up cfg-gating of ProcessPrng extern
1 parent d37ebfe commit e99c681

File tree

1 file changed

+16
-13
lines changed
  • std/src/sys/pal/windows

1 file changed

+16
-13
lines changed

Diff for: std/src/sys/pal/windows/c.rs

+16-13
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,22 @@ if #[cfg(not(target_vendor = "uwp"))] {
109109
}
110110

111111
// Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
112-
cfg_if::cfg_if! {
113-
if #[cfg(not(target_vendor = "win7"))] {
114-
#[cfg(target_arch = "x86")]
115-
#[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")]
116-
extern "system" {
117-
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
118-
}
119-
#[cfg(not(target_arch = "x86"))]
120-
#[link(name = "bcryptprimitives", kind = "raw-dylib")]
121-
extern "system" {
122-
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
123-
}
124-
}}
112+
#[cfg(not(target_vendor = "win7"))]
113+
#[cfg_attr(
114+
target_arch = "x86",
115+
link(
116+
name = "bcryptprimitives",
117+
kind = "raw-dylib",
118+
import_name_type = "undecorated"
119+
)
120+
)]
121+
#[cfg_attr(
122+
not(target_arch = "x86"),
123+
link(name = "bcryptprimitives", kind = "raw-dylib")
124+
)]
125+
extern "system" {
126+
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
127+
}
125128

126129
// Functions that aren't available on every version of Windows that we support,
127130
// but we still use them and just provide some form of a fallback implementation.

0 commit comments

Comments
 (0)