rust-lang / rust-lang/rust-clippy

"should lint" comments should always be on the same line as test

Open
#9,437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Description

There are a lot of "should lint" / "should not lint" comments inside the tests but their placement is not uniform.

Some are like this:

// should lint
num.unwrap_or(...)

and others:

num.unwrap_or(...) // should lint

Since adding new rules/lints will potentially change behavior in future, I suggest we stick to second format, thus when a change is introduced, we can see it in the same line, e.g. using git diff, without having to read each test case file and look for its "header".

Version

No response

Additional Labels

No response

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

Search the repository's tests for "should lint" and "should not lint" comments, then inspect the surrounding test cases to identify the inconsistent placements. Standardize them so each comment is on the same line as the test expression, and run the affected tests to confirm behavior is unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, testing
Issue type
Refactor
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.