rust-lang / rust-lang/rust-clippy

allow-unwrap-in-tests (etc) do not work for integration tests / examples / benches

Open
#13,981 4 comments 24 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.