Skip to content

Option to #[allow] additional lints #302

Description

@GoldsteinE

Currently trybuild automatically allows dead_code. I’d like to be able to allow other lints.

Use case: I have a macro that generates output with some #[cfg]s. These #[cfg]s mention Cargo features that are expected to be present in the caller crate. When used in trybuild-generated crate, they produce an unexpected_cfgs lint, which clutters .stderr files. I would like to disable unexpected_cfgs for all my trybuild test cases without manually writing #![allow] in every one. The syntax could look like this:

let t = trybuild::TestCases::new()
    .with_allowed_lint("unexpected_cfgs");
t.pass("path/to/file.rs");
t.compile_fail("another/file.rs");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions