Skip to content

Commit 1c4873c

Browse files
Remove usage of cfg_if in std/src/os/mod.rs
1 parent 8d879aa commit 1c4873c

File tree

1 file changed

+71
-31
lines changed

1 file changed

+71
-31
lines changed

Diff for: library/std/src/os/mod.rs

+71-31
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,81 @@ pub mod raw;
1818
pub mod fortanix_sgx;
1919

2020
// Unix, linux, wasi and windows are handled a bit differently.
21-
cfg_if::cfg_if! {
22-
if #[cfg(all(
23-
doc,
24-
any(
25-
all(target_arch = "wasm32", not(target_os = "wasi")),
26-
all(target_vendor = "fortanix", target_env = "sgx")
27-
)
28-
))]
29-
{
30-
#[unstable(issue = "none", feature = "std_internals")]
31-
pub mod unix {}
32-
#[unstable(issue = "none", feature = "std_internals")]
33-
pub mod linux {}
34-
#[unstable(issue = "none", feature = "std_internals")]
35-
pub mod wasi {}
36-
#[unstable(issue = "none", feature = "std_internals")]
37-
pub mod windows {}
38-
} else {
39-
#[cfg(target_os = "hermit")]
40-
#[path = "hermit/mod.rs"]
41-
pub mod unix;
21+
#[cfg(all(
22+
doc,
23+
any(
24+
all(target_arch = "wasm32", not(target_os = "wasi")),
25+
all(target_vendor = "fortanix", target_env = "sgx")
26+
)
27+
))]
28+
#[unstable(issue = "none", feature = "std_internals")]
29+
pub mod unix {}
30+
#[cfg(all(
31+
doc,
32+
any(
33+
all(target_arch = "wasm32", not(target_os = "wasi")),
34+
all(target_vendor = "fortanix", target_env = "sgx")
35+
)
36+
))]
37+
#[unstable(issue = "none", feature = "std_internals")]
38+
pub mod linux {}
39+
#[cfg(all(
40+
doc,
41+
any(
42+
all(target_arch = "wasm32", not(target_os = "wasi")),
43+
all(target_vendor = "fortanix", target_env = "sgx")
44+
)
45+
))]
46+
#[unstable(issue = "none", feature = "std_internals")]
47+
pub mod wasi {}
48+
#[cfg(all(
49+
doc,
50+
any(
51+
all(target_arch = "wasm32", not(target_os = "wasi")),
52+
all(target_vendor = "fortanix", target_env = "sgx")
53+
)
54+
))]
55+
#[unstable(issue = "none", feature = "std_internals")]
56+
pub mod windows {}
4257

43-
#[cfg(any(unix, doc))]
44-
pub mod unix;
58+
// unix
59+
#[cfg(not(any(
60+
all(target_arch = "wasm32", not(target_os = "wasi")),
61+
all(target_vendor = "fortanix", target_env = "sgx")
62+
)))]
63+
#[cfg(all(not(doc), target_os = "hermit"))]
64+
#[path = "hermit/mod.rs"]
65+
pub mod unix;
66+
#[cfg(not(any(
67+
all(target_arch = "wasm32", not(target_os = "wasi")),
68+
all(target_vendor = "fortanix", target_env = "sgx")
69+
)))]
70+
#[cfg(any(unix, doc))]
71+
pub mod unix;
4572

46-
#[cfg(any(target_os = "linux", target_os = "l4re", doc))]
47-
pub mod linux;
73+
// linux
74+
#[cfg(not(any(
75+
all(target_arch = "wasm32", not(target_os = "wasi")),
76+
all(target_vendor = "fortanix", target_env = "sgx")
77+
)))]
78+
#[cfg(any(target_os = "linux", target_os = "l4re", doc))]
79+
pub mod linux;
4880

49-
#[cfg(any(target_os = "wasi", doc))]
50-
pub mod wasi;
81+
// wasi
82+
#[cfg(not(any(
83+
all(target_arch = "wasm32", not(target_os = "wasi")),
84+
all(target_vendor = "fortanix", target_env = "sgx")
85+
)))]
86+
#[cfg(any(target_os = "wasi", doc))]
87+
pub mod wasi;
5188

52-
#[cfg(any(windows, doc))]
53-
pub mod windows;
54-
}
55-
}
89+
// windows
90+
#[cfg(not(any(
91+
all(target_arch = "wasm32", not(target_os = "wasi")),
92+
all(target_vendor = "fortanix", target_env = "sgx")
93+
)))]
94+
#[cfg(any(windows, doc))]
95+
pub mod windows;
5696

5797
// Others.
5898
#[cfg(target_os = "android")]

0 commit comments

Comments
 (0)