alexcrichton opened PR #7561 from alexcrichton:lint-config
to bytecodealliance:main
:
This PR is a series of commits building up to the ability to selectively enable clippy lints to prevent issues such as https://github.com/bytecodealliance/wasmtime/issues/7558 from occurring. The root cause of the issue is the behavior of casting a smaller integer to a larger integer and switching signs. For example casting an i8 to a u32. I certainly don't remember whether this is a zero-extend or a sign-extend, and I suspect that I'm not alone. Ideally I was looking for a lint to help weed these out on CI.
Unfortunately rustc does not have a lint for this. Clippy, however, has a somewhat similar lint called
cast_sign_loss
. Empowered with Rust's 1.74 release and Cargo's addition of a[lints]
configuration for workspaces, I realized this seemed like a reasonable time to kick the tires. Historically Wasmtime hasn't enabled Clippy because it's too noisy by default and it's too cumbersome to turn it off for all crates. With[lints]
however it's a single line to turn off all clippy for the entire workspace, which felt like a much better balance to me at least.First configuring
[lints]
as well as[workspace.lints]
helped moved some lint configuration for various crates into one location. Afterwards all clippy lints were then disabled and thencargo clippy
was added to CI. It turns out thatcast_sign_loss
is still too noisy for our purposes to enable for the whole workspace, but it can be selectively enabled for a few crates in question which do at least much of the casting for values at runtime.This is intended to be somewhat of a trial run to see if we can make running Clippy in CI useful. I'm sure Clippy has other useful lints for helping to catch issues as well as helping with stylistic things for contributors. For now everything is left disabled but if desired selective lints can be enabled as necessary.
alexcrichton requested wasmtime-fuzz-reviewers for a review on PR #7561.
alexcrichton requested abrown for a review on PR #7561.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #7561.
alexcrichton requested wasmtime-core-reviewers for a review on PR #7561.
alexcrichton requested pchickey for a review on PR #7561.
alexcrichton requested wasmtime-default-reviewers for a review on PR #7561.
pchickey submitted PR review.
alexcrichton updated PR #7561.
alexcrichton merged PR #7561.
Last updated: Dec 23 2024 at 12:05 UTC