Skip to content

Commit c06731b

Browse files
refactor: use target_arch instead of target_os for wasm cfg's
As far as I can tell, this is equivalent and less verbose. Pull-Request: #3572.
1 parent ad02201 commit c06731b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

libp2p/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ libp2p-yamux = { version = "0.43.0", path = "../muxers/yamux", optional = true }
113113
multiaddr = { version = "0.17.0" }
114114
pin-project = "1.0.0"
115115

116-
[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies]
116+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
117117
libp2p-deflate = { version = "0.39.0", path = "../transports/deflate", optional = true }
118118
libp2p-dns = { version = "0.39.0", path = "../transports/dns", optional = true }
119119
libp2p-mdns = { version = "0.43.0", path = "../protocols/mdns", optional = true }

libp2p/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ pub use libp2p_core as core;
4949
#[doc(inline)]
5050
pub use libp2p_dcutr as dcutr;
5151
#[cfg(feature = "deflate")]
52-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
52+
#[cfg(not(target_arch = "wasm32"))]
5353
#[doc(inline)]
5454
pub use libp2p_deflate as deflate;
5555
#[cfg(feature = "dns")]
5656
#[cfg_attr(docsrs, doc(cfg(feature = "dns")))]
57-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
57+
#[cfg(not(target_arch = "wasm32"))]
5858
#[doc(inline)]
5959
pub use libp2p_dns as dns;
6060
#[cfg(feature = "floodsub")]
@@ -71,7 +71,7 @@ pub use libp2p_identify as identify;
7171
#[doc(inline)]
7272
pub use libp2p_kad as kad;
7373
#[cfg(feature = "mdns")]
74-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
74+
#[cfg(not(target_arch = "wasm32"))]
7575
#[cfg_attr(docsrs, doc(cfg(feature = "mdns")))]
7676
#[doc(inline)]
7777
pub use libp2p_mdns as mdns;
@@ -94,7 +94,7 @@ pub use libp2p_plaintext as plaintext;
9494
#[doc(inline)]
9595
pub use libp2p_pnet as pnet;
9696
#[cfg(feature = "quic")]
97-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
97+
#[cfg(not(target_arch = "wasm32"))]
9898
#[doc(inline)]
9999
pub use libp2p_quic as quic;
100100
#[cfg(feature = "relay")]
@@ -109,30 +109,30 @@ pub use libp2p_request_response as request_response;
109109
#[doc(inline)]
110110
pub use libp2p_swarm as swarm;
111111
#[cfg(feature = "tcp")]
112-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
112+
#[cfg(not(target_arch = "wasm32"))]
113113
#[cfg_attr(docsrs, doc(cfg(feature = "tcp")))]
114114
#[doc(inline)]
115115
pub use libp2p_tcp as tcp;
116116
#[cfg(feature = "tls")]
117117
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
118-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
118+
#[cfg(not(target_arch = "wasm32"))]
119119
#[doc(inline)]
120120
pub use libp2p_tls as tls;
121121
#[cfg(feature = "uds")]
122122
#[cfg_attr(docsrs, doc(cfg(feature = "uds")))]
123-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
123+
#[cfg(not(target_arch = "wasm32"))]
124124
#[doc(inline)]
125125
pub use libp2p_uds as uds;
126126
#[cfg(feature = "wasm-ext")]
127127
#[doc(inline)]
128128
pub use libp2p_wasm_ext as wasm_ext;
129129
#[cfg(feature = "webrtc")]
130130
#[cfg_attr(docsrs, doc(cfg(feature = "webrtc")))]
131-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
131+
#[cfg(not(target_arch = "wasm32"))]
132132
#[doc(inline)]
133133
pub use libp2p_webrtc as webrtc;
134134
#[cfg(feature = "websocket")]
135-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
135+
#[cfg(not(target_arch = "wasm32"))]
136136
#[doc(inline)]
137137
pub use libp2p_websocket as websocket;
138138
#[cfg(feature = "yamux")]
@@ -168,7 +168,7 @@ pub use self::transport_ext::TransportExt;
168168
/// > **Note**: This `Transport` is not suitable for production usage, as its implementation
169169
/// > reserves the right to support additional protocols or remove deprecated protocols.
170170
#[cfg(all(
171-
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
171+
not(target_arch = "wasm32"),
172172
any(
173173
all(feature = "tcp-async-io", feature = "dns-async-std"),
174174
all(feature = "tcp", feature = "dns", feature = "async-std")
@@ -228,7 +228,7 @@ pub async fn development_transport(
228228
/// > **Note**: This `Transport` is not suitable for production usage, as its implementation
229229
/// > reserves the right to support additional protocols or remove deprecated protocols.
230230
#[cfg(all(
231-
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
231+
not(target_arch = "wasm32"),
232232
any(
233233
all(feature = "tcp-tokio", feature = "dns-tokio"),
234234
all(feature = "tcp", feature = "dns", feature = "tokio")

0 commit comments

Comments
 (0)