rust-lang / rust-lang/rust-clippy

`allow_attributes` Lint does not trigger on `#[allow(warnings)]`

Open
#13,425 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-false-negative
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

This is probably a bit weird, but I found this in some code: #[allow(warnings)] annotated on a function to mute all warnings in it. Now I am using the clippy::allow_attributes Lint and expected to be forced to write expect. But nothing like this happened.

Lint Name

allow_attributes

Reproducer

I tried this code:

#[allow(warnings)]
fn foo(input: &str) {
    let _first_value = input.split(',').nth(0).unwrap();
}

I expected to see this happen:

clippy telling me to write expect instead of allow

Instead, this happened:

the warning was muted so the allow(warnings) seems to be something valid, but clippy did not instruct me to use expect

Version
rustc 1.83.0-nightly (f79a912d9 2024-09-18)
binary: rustc
commit-hash: f79a912d9edc3ad4db910c0e93672ed5c65133fa
commit-date: 2024-09-18
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

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.

Research direction

Start at the allow_attributes lint entry point and reproduce the issue with the Rust snippet in this report. Done means the lint reports #[allow(warnings)] and recommends expect as described, with the existing behavior checked against the reproducer.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.