nushell/crates/nu-system/Cargo.toml
Piepmatz 4b1f4e63c3
Replace std::time::Instant with web_time::Instant (#14668)
# Description
The `std::time::Instant` type panics in the WASM context. To prevent
this, I replaced all uses of `std::time::Instant` in WASM-relevant
crates with `web_time::Instant`. This ensures commands using `Instant`
work in WASM without issues. For non-WASM targets, `web-time` simply
reexports `std::time`, so this change doesn’t affect regular builds
([docs](https://docs.rs/web-time/latest/web_time/)).

To ensure future code doesn't reintroduce `std::time::Instant` in WASM
contexts, I added a `clippy wasm` command to the toolkit. This runs
`cargo clippy` with a `clippy.toml` configured to disallow
`std::time::Instant`. Since `web-time` aliases `std::time` by default,
the `clippy.toml` is stored in `clippy/wasm` and is only loaded when
targeting WASM. I also added a new CI job that tests this too.

# User-Facing Changes

None.
2024-12-25 16:50:02 +08:00

51 lines
1.4 KiB
TOML

[package]
authors = ["The Nushell Project Developers", "procs creators"]
description = "Nushell system querying"
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-system"
name = "nu-system"
version = "0.101.1"
edition = "2021"
license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
bench = false
[lints]
workspace = true
[dependencies]
libc = { workspace = true }
log = { workspace = true }
sysinfo = { workspace = true }
itertools = { workspace = true }
web-time = { workspace = true }
[target.'cfg(target_family = "unix")'.dependencies]
nix = { workspace = true, default-features = false, features = ["fs", "term", "process", "signal"] }
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
procfs = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies]
libproc = { workspace = true }
mach2 = { workspace = true }
[target.'cfg(target_os = "windows")'.dependencies]
chrono = { workspace = true, default-features = false, features = ["clock"] }
ntapi = "0.4"
windows = { workspace = true, features = [
"Wdk_System_SystemServices",
"Wdk_System_Threading",
"Win32_Foundation",
"Win32_Security",
"Win32_System_Diagnostics_Debug",
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_Kernel",
"Win32_System_Memory",
"Win32_System_ProcessStatus",
"Win32_System_SystemInformation",
"Win32_System_Threading",
"Win32_UI_Shell",
]}