rust-lang / rust-lang/rust-clippy

lints to disable in tests

Open
#12,581 5 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

In Arti have things like the following:

#[cfg(test)]
mod test {
    // @@ begin test lint list maintained by maint/add_warning @@
    #![allow(clippy::bool_assert_comparison)]
    #![allow(clippy::clone_on_copy)]
    #![allow(clippy::dbg_macro)]
    #![allow(clippy::mixed_attributes_style)]
    #![allow(clippy::print_stderr)]
    #![allow(clippy::print_stdout)]
    #![allow(clippy::single_char_pattern)]
    #![allow(clippy::unwrap_used)]
    #![allow(clippy::unchecked_duration_subtraction)]
    #![allow(clippy::useless_vec)]
    #![allow(clippy::needless_pass_by_value)]
    //! <!-- @@ end test lint list maintained by maint/add_warning @@ -->
    // TODO add this next lint to maint/add_warning, for all tests
    #![allow(clippy::iter_overeager_cloned)]

Our maint/add_warning is a Python script that keeps the (currently) 236 copies of this lint block in sync across our 61 crates.

It would be nice if there were a way to systematically and centrally disable these lints for all our tests. Probably, many of them should be disabled by default.

(@llogiq suggested I should file this ticket)

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

Start by reading the maint/add_warning Python script and examining the repeated test lint blocks across the 61 crates. Investigate whether Rust or Clippy configuration provides a central way to disable these lints for tests, and define done as removing the need to maintain the 236 copied blocks while preserving the intended lint behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.