Skip to content

Expose lint levels from CLI #14522

@Kixunil

Description

@Kixunil

Problem

There are cases when it's not desirable configuring the lint levels using Cargo.toml and RUST(DOC)FLAGS is not discoverable and also has the footgun that RUSTFLAGS != RUSTDOCFLAGS. Specifically it's useful to have things like #![warn(missing_docs)] in the lib.rs but deny the warning in the CI because it's annoying to have to document everything if one is just designing the API and manually editing the file (potentially accidentally committing it) is also annoying. Editing Cargo.toml from CI's shell script is fragile.

Proposed Solution

It'd be best to just expose the lint levels from cargo and make sure cargo sets them correctly for rustc and rustdoc. Also please don't forget forbid because that level is also useful and even if it's not super-important it'll be probably just a few more lines once other lint levels are in.

Notes

I've opened this as requested in #12739 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: rustc lint configurationC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions