mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Prerequisite of https://github.com/emilk/egui/pull/6744. See: https://github.com/gfx-rs/wgpu/pull/7218, https://github.com/gfx-rs/wgpu/pull/7425 Please be aware that Rust 1.84 enables some (more) WASM extensions by default, and ships with an `std` built with them enabled: https://blog.rust-lang.org/2024/09/24/webassembly-targets-change-in-default-target-features/ According to `rustc +1.84 --print=cfg --target wasm32-unknown-unknown`, these are: `multivalue`, `mutable-globals`, `reference-types`, and `sign-ext`. (c.f. `rustc +1.84 --print=cfg --target wasm32-unknown-unknown -C target-cpu=mvp` enabling none.) For reference: https://webassembly.org/features/ ---- If support is desired for ancient/esoteric browsers that don't have these implemented, there are two ways to get around this: - Target `wasm32v1-none` instead, but that's a `no-std` target, and I suppose a lot of dependencies don't work that way (e.g. https://github.com/gfx-rs/wgpu/issues/6826) - Using the `-Ctarget-cpu=mvp` and `-Zbuild-std=panic_abort,std` flags, and the `RUSTC_BOOTSTRAP=1` escape hatch to allow using the latter with non-`nightly` toolchains - until https://github.com/rust-lang/wg-cargo-std-aware is stabilized. (For reference: https://github.com/ruffle-rs/ruffle/pull/18528/files#diff-fb2896d189d77b35ace9a079c1ba9b55777d16e0f11ce79f776475a451b1825a) I don't think either of these is particularly advantageous, so I suggest just accepting that browsers will have to have some extensions implemented to run `egui`.
56 lines
2.1 KiB
TOML
56 lines
2.1 KiB
TOML
# This is used by `scripts/clippy_wasm.sh` so we can forbid some methods that are not available in wasm.
|
|
#
|
|
# We cannot forbid all these methods in the main `clippy.toml` because of
|
|
# https://github.com/rust-lang/rust-clippy/issues/10406
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Section identical to the root clippy.toml:
|
|
|
|
msrv = "1.84"
|
|
|
|
allow-unwrap-in-tests = true
|
|
|
|
# https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api
|
|
# We want suggestions, even if it changes public API.
|
|
avoid-breaking-exported-api = false
|
|
|
|
max-fn-params-bools = 2 # TODO(emilk): decrease this to 1
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file
|
|
max-include-file-size = 1000000
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#/type_complexity
|
|
type-complexity-threshold = 350
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
|
|
disallowed-methods = [
|
|
"std::time::Instant::now", # use `instant` crate instead for wasm/web compatibility
|
|
"std::time::Duration::elapsed", # use `instant` crate instead for wasm/web compatibility
|
|
"std::time::SystemTime::now", # use `instant` or `time` crates instead for wasm/web compatibility
|
|
|
|
# Cannot spawn threads on wasm:
|
|
"std::thread::spawn",
|
|
]
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
|
|
disallowed-types = [
|
|
{ path = "instant::SystemTime", reason = "Known bugs. Use web-time." },
|
|
{ path = "std::thread::Builder", reason = "Cannot spawn threads on wasm" },
|
|
{ path = "std::time::Instant", reason = "Use web-time instead." },
|
|
# { path = "std::path::PathBuf", reason = "Can't read/write files on web" }, // TODO(emilk): consider banning Path on wasm
|
|
]
|
|
|
|
# Allow-list of words for markdown in docstrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
|
|
doc-valid-idents = [
|
|
# You must also update the same list in the root `clippy.toml`!
|
|
"AccessKit",
|
|
"WebGL",
|
|
"WebGL1",
|
|
"WebGL2",
|
|
"WebGPU",
|
|
"VirtualBox",
|
|
"..",
|
|
]
|