You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most Clippy users think of linting in two ways: check for the common issues (default), and check for the less agreed on or controversial issues (pedantic/perf/...). Clippy represents those usage patterns as multiple sets of lints, where each lint belongs to just one category, i.e. style and pedantic.
The problem is that some lints are not so clear-cut. They have additional configuration to make them more or less strict. Yet we must still decide which category they belong to -- either style with just a few checks, or pedantic with a lot of checks, but not commonly used by the majority of users.
Moreover, adding lint configuration requires that each Clippy user has to switch to a different mental model - instead of the "default" vs "pedantic", they must start reading documentation on each lint and configuring those lints, plus monitor for any changes between Clippy versions. Obviously most users ignore this to use the default configuration, which significantly impacts discoverability of additional functionality.
Proposal
I would like to propose a new "intention" (or mode) Clippy concept, e.g. a mutually exclusive command line argument (--default | --pedantic | ...). Using the --pedantic argument would automatically set -W clippy::pedantic, but it would also allow the other enabled lints to use the pedantic configuration. The users will be able to easily switch between the two modes, will help with discoverability, and also allow Clippy to have a more flexible lint categorization.
Examples
For example, --pedantic could enable the following lints to act differently:
clippy::uninlined_format_args - inline simple cases like format!("{}", foo) → format!("{foo}") by default, but will only inline mixed cases format!("{}:{}", foo, bar.baz()) → format!("{foo}:{}", bar.bas()) in the pedantic mode.
... TBD
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Problem Description
Most Clippy users think of linting in two ways: check for the common issues (default), and check for the less agreed on or controversial issues (pedantic/perf/...). Clippy represents those usage patterns as multiple sets of lints, where each lint belongs to just one category, i.e.
style
andpedantic
.The problem is that some lints are not so clear-cut. They have additional configuration to make them more or less strict. Yet we must still decide which category they belong to -- either
style
with just a few checks, orpedantic
with a lot of checks, but not commonly used by the majority of users.Moreover, adding lint configuration requires that each Clippy user has to switch to a different mental model - instead of the "default" vs "pedantic", they must start reading documentation on each lint and configuring those lints, plus monitor for any changes between Clippy versions. Obviously most users ignore this to use the default configuration, which significantly impacts discoverability of additional functionality.
Proposal
I would like to propose a new "intention" (or mode) Clippy concept, e.g. a mutually exclusive command line argument
(--default | --pedantic | ...)
. Using the--pedantic
argument would automatically set-W clippy::pedantic
, but it would also allow the other enabled lints to use the pedantic configuration. The users will be able to easily switch between the two modes, will help with discoverability, and also allow Clippy to have a more flexible lint categorization.Examples
For example,
--pedantic
could enable the following lints to act differently:clippy::uninlined_format_args
- inline simple cases likeformat!("{}", foo) → format!("{foo}")
by default, but will only inline mixed casesformat!("{}:{}", foo, bar.baz()) → format!("{foo}:{}", bar.bas())
in the pedantic mode.The text was updated successfully, but these errors were encountered: