mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 14:50:03 -04:00
Run special clippy for wasm, forbidding some types/methods
This commit is contained in:
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
@@ -156,6 +156,8 @@ jobs:
|
|||||||
|
|
||||||
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
|
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
|
||||||
|
|
||||||
|
- run: ./scripts/clippy_wasm.sh
|
||||||
|
|
||||||
- name: Cranky wasm32
|
- name: Cranky wasm32
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
11
clippy.toml
11
clippy.toml
@@ -1 +1,10 @@
|
|||||||
doc-valid-idents = ["AccessKit", ".."]
|
# There is also a scripts/clippy_wasm/clippy.toml which forbids some mthods that are not available in wasm.
|
||||||
|
|
||||||
|
msrv = "1.65"
|
||||||
|
|
||||||
|
# Allow-list of words for markdown in dosctrings 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",
|
||||||
|
"..",
|
||||||
|
]
|
||||||
|
|||||||
13
scripts/clippy_wasm.sh
Executable file
13
scripts/clippy_wasm.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# This scripts run clippy on the wasm32-unknown-unknown target,
|
||||||
|
# using a special clippy.toml config file which forbids a few more things.
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||||
|
cd "$script_path/.."
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# Use scripts/clippy_wasm/clippy.toml
|
||||||
|
export CLIPPY_CONF_DIR="scripts/clippy_wasm"
|
||||||
|
|
||||||
|
cargo cranky --all-features --target wasm32-unknown-unknown --target-dir target_wasm -p egui_demo_app --lib -- --deny warnings
|
||||||
29
scripts/clippy_wasm/clippy.toml
Normal file
29
scripts/clippy_wasm/clippy.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
msrv = "1.65"
|
||||||
|
|
||||||
|
# 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 = [
|
||||||
|
# Cannot spawn threads on wasm:
|
||||||
|
"std::thread::Builder",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Allow-list of words for markdown in dosctrings 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",
|
||||||
|
"..",
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user