dtolnay / dtolnay/trybuild

Option to `#[allow]` additional lints

Open
#302 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
998
Forks
84
PR merge metrics
No merged PRs in 30d

Description

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:

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.