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

Add workspace-wide clippy lint lists #518

Open
epilys opened this issue Nov 2, 2023 · 0 comments
Open

Add workspace-wide clippy lint lists #518

epilys opened this issue Nov 2, 2023 · 0 comments

Comments

@epilys
Copy link
Member

epilys commented Nov 2, 2023

Quoting #514 (comment):

Is it possible to enable these in some way for the entire workspace?

Good question. It's gonna be possible in stable soon:

https://rust-lang.github.io/rfcs/3389-manifest-lint.html

Quoting the RFC:

Currently, you can configure lints through

    #[<level>(<lint>)] or #![<level>(<lint>)], like #[forbid(unsafe)]
        But this doesn't scale up with additional targets (benches, examples, tests) or workspaces
    On the command line, like cargo clippy -- --forbid unsafe
        This puts the burden on the caller
    Through RUSTFLAGS, like RUSTFLAGS=--forbid=unsafe cargo clippy
        This puts the burden on the caller
    In .cargo/config.toml's target.*.rustflags
        This couples you to the running in specific directories and not running in the right directory causes rebuilds
        The cargo team has previously stated that [they would like to see package-specific config moved to manifests](https://internals.rust-lang.org/t/proposal-move-some-cargo-config-settings-to-cargo-toml/13336/14?u=epage)

So to enable them for the workspace we could put them in RUSTFLAGS for all targets in a .cargo/config.toml.

We should fix this when [lints] is added in the stable we target.

epilys added a commit to epilys/vhost-device that referenced this issue Nov 19, 2023
From Rust 1.74 and onwards, this section enables opt-in lints for crates
of this workspace. Read more information at https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html

For a crate to opt-in, it needs to set

 [lints]
 workspace = true

In its Cargo.toml

Closes rust-vmm#518

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant