rust-lang / rust-lang/rust-clippy
suggestion: Differentiate size-thresholds levels (forbid, deny, warn)
Nobody has claimed this yet.
- 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_framesforstack-size-threshold = 4096 -
warn
large_stack_framesforstack-size-threshold = 2048
-
deny
large_stack_arraysforarray-size-threshold = 32 -
warn
large_stack_arraysforarray-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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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