Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow dead code/unused imports by default in wasmtime crate #10108

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexcrichton
Copy link
Member

This PR is a change to the crate attributes of the wasmtime crate. Quite some time ago when Wasmtime had far fewer crate features I added a directive to allow dead code and unused imports when the default feature was disabled. The original intention was to not worry too much about unused imports and dead code in every possible configuration of Wasmtime to ease the burden of dealing with unused imports or compile-time conditionally used code.

The primary consequence of this change though is that cargo build doesn't actually warn about dead code or unused imports in this repository during development. The reason for this is that the default feature is disabled by default and never actually enabled by any dependency inside the repository. Instead each crate, like wasmtime-cli, has its own default feature.

If I were to start from the problem of "I want dead code warnings by default in this repository" there's two possible fixes:

  1. Change wasmtime-cli's default feature to include wasmtime/default.
  2. Remove this #[allow] directive.

While (1) would indeed work this is an attempt to get (2) working to see how bad the changes are necessary within the crate.

prtest:full

This PR is a change to the crate attributes of the `wasmtime` crate.
Quite some time ago when Wasmtime had far fewer crate features I added a
directive to allow dead code and unused imports when the `default`
feature was disabled. The original intention was to not worry too much
about unused imports and dead code in every possible configuration of
Wasmtime to ease the burden of dealing with unused imports or
compile-time conditionally used code.

The primary consequence of this change though is that `cargo build`
doesn't actually warn about dead code or unused imports in this
repository during development. The reason for this is that the `default`
feature is disabled by default and never actually enabled by any
dependency inside the repository. Instead each crate, like
`wasmtime-cli`, has its own `default` feature.

If I were to start from the problem of "I want dead code warnings by
default in this repository" there's two possible fixes:

1. Change `wasmtime-cli`'s `default` feature to include `wasmtime/default`.
2. Remove this `#[allow]` directive.

While (1) would indeed work this is an attempt to get (2) working to see
how bad the changes are necessary within the crate.

prtest:full
@alexcrichton
Copy link
Member Author

Oof that's a lot of red

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant