rust-lang / rust-lang/rust-clippy

suggestion: Differentiate size-thresholds levels (forbid, deny, warn)

Open
#15,737 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-ui C-feature-request
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

I suggesting new way to set up various levels for thresholds, e.g.:

  • forbid large_stack_frames for stack-size-threshold = 4096

  • warn large_stack_frames for stack-size-threshold = 2048


  • deny large_stack_arrays for array-size-threshold = 32

  • warn large_stack_arrays for array-size-threshold = 16

It could be configurable in clippy.toml like this:

stack-size-threshold.forbid = 4096
# or
stack-size-threshold = { forbid = 4096, warn = 2048, ... }
# and same for array-size-threshold:
array-size-threshold.deny = 32
array-size-threshold.warn = 16

This issue describes possible improvement for clippy.toml size-thresholds configuration.
But because clippy.toml works globally for entire "project" (workspace or just crate with multiple different-purposed functions), this suggestioned changes could be highly useful in general, but not in special cases with various stack-sizes and cache-lines.
That's why I'v also create another suggestion (#15735) about a way to specify thresholds precisely for concrete item or scope.
There is also described my motivation for both suggestions.

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

Review the current clippy.toml settings for large_stack_frames and large_stack_arrays first. Compare this proposal with suggestion #15735, then determine the configuration syntax and precedence for forbid, deny, and warn levels. Done means an agreed, implementable design with clear behavior for each threshold level.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.