vhost-device icon indicating copy to clipboard operation
vhost-device copied to clipboard

Add workspace-wide clippy lint lists

Open epilys opened this issue 1 year ago • 0 comments

Quoting https://github.com/rust-vmm/vhost-device/pull/514#discussion_r1379768713:

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 avatar Nov 02 '23 09:11 epilys