rust-lang / rust-lang/rust-clippy
allow-unwrap-in-tests (etc) do not work for integration tests / examples / benches
Open
@ClementTsang is already working on this.
Since Mar 31, 2026.
C-feature-request
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Clippy lets you do the following:
# Cargo.toml
[lints.clippy]
unwrap-used = true
# clippy.toml
allow-unwrap-in-tests = true
This stops code that is cfg(test) or #[test] from getting linted. However, this does not affect code in test/ (etc)., since that code isn't cfg(test).
is_in_test() probably should take that into account?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.