Skip to content

Commit 9f6d39f

Browse files
committed
fix: Use target_os instead of feature.
1 parent 43893b5 commit 9f6d39f

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ utils = ["gloo-utils"]
5858
history = ["gloo-history"]
5959
worker = ["gloo-worker"]
6060
net = ["gloo-net"]
61-
wasi = ["gloo-history/wasi"]
6261

6362
[workspace]
6463
members = [

crates/history/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ gloo-timers = { version = "0.3.0", features = ["futures"], path = "../timers" }
3333

3434
[features]
3535
query = ["thiserror", "serde_urlencoded"]
36-
wasi = []
3736
default = ["query"]

crates/history/src/utils.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ use std::cell::RefCell;
22
use std::rc::{Rc, Weak};
33
use std::sync::atomic::{AtomicU32, Ordering};
44

5-
#[cfg(not(feature = "wasi"))]
5+
#[cfg(not(target_os = "wasi"))]
66
use wasm_bindgen::throw_str;
77

8-
#[cfg(any(not(target_arch = "wasm32"), feature = "wasi"))]
8+
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
99
pub(crate) fn get_id() -> u32 {
1010
static ID_CTR: AtomicU32 = AtomicU32::new(0);
1111

1212
ID_CTR.fetch_add(1, Ordering::SeqCst)
1313
}
1414

15-
#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
15+
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
1616
pub(crate) fn get_id() -> u32 {
1717
static ID_CTR: AtomicU32 = AtomicU32::new(0);
1818
static INIT: std::sync::Once = std::sync::Once::new();
@@ -31,27 +31,27 @@ pub(crate) fn get_id() -> u32 {
3131

3232
pub(crate) fn assert_absolute_path(path: &str) {
3333
if !path.starts_with('/') {
34-
#[cfg(not(feature = "wasi"))]
34+
#[cfg(not(target_os = "wasi"))]
3535
throw_str("You cannot use relative path with this history type.");
36-
#[cfg(feature = "wasi")]
36+
#[cfg(target_os = "wasi")]
3737
panic!("You cannot use relative path with this history type.");
3838
}
3939
}
4040

4141
pub(crate) fn assert_no_query(path: &str) {
4242
if path.contains('?') {
43-
#[cfg(not(feature = "wasi"))]
43+
#[cfg(not(target_os = "wasi"))]
4444
throw_str("You cannot have query in path, try use a variant of this method with `_query`.");
45-
#[cfg(feature = "wasi")]
45+
#[cfg(target_os = "wasi")]
4646
panic!("You cannot have query in path, try use a variant of this method with `_query`.");
4747
}
4848
}
4949

5050
pub(crate) fn assert_no_fragment(path: &str) {
5151
if path.contains('#') {
52-
#[cfg(not(feature = "wasi"))]
52+
#[cfg(not(target_os = "wasi"))]
5353
throw_str("You cannot use fragments (hash) in memory history.");
54-
#[cfg(feature = "wasi")]
54+
#[cfg(target_os = "wasi")]
5555
panic!("You cannot use fragments (hash) in memory history.");
5656
}
5757
}

crates/history/tests/query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![cfg(feature = "query")]
22

3-
#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
3+
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
44
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
5-
#[cfg(all(target_arch = "wasm32", not(feature = "wasi")))]
5+
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
66
wasm_bindgen_test_configure!(run_in_browser);
77

88
use gloo_history::query::*;

0 commit comments

Comments
 (0)