Description
Summary
I have renamed_function_params
lint enabled for foreign traits implementations, which means that a sample impl
block for Display
trait looks something like this:
impl Display for Foo {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "{}", self.bar())
}
}
Enabling min_ident_chars
on this code correctly flags f
argument for fmt
method.
I can disable this on the impl
block, but I'm implementing this multiple times across the crate. Adding to each implementation can become needless noise. However, I still want to flag any instances of single-character arguments on my traits.
Using the configuration allowed-idents-below-min-chars
also doesn't make sense as I'd still want to flag f
as an argument name on my traits.
I believe this lint should not be triggering on function arguments on impl blocks as their implementation details are provided by the crate owners.
In case this is not in the scope of this lint, may I propose a configuration option to disable triggering this lint on impl
blocks min-ident-chars-ignore-impl
Lint Name
min_ident_chars
Reproducer
I tried this code:
impl Display for Foo {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "{}", self.bar())
}
}
I saw this happen:
warning: this ident consists of a single char
--> src\core\card.rs:263:19
|
20 | fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
| ^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#min_ident_chars
= note: requested on the command line with `-W clippy::min-ident-chars`
I expected to see this happen:
The lint should not trigger
Version
rustc 1.83.0-nightly (adaff5368 2024-09-12)
binary: rustc
commit-hash: adaff5368b0c7b328a0320a218751d65ab1bba97
commit-date: 2024-09-12
host: x86_64-pc-windows-msvc
release: 1.83.0-nightly
LLVM version: 19.1.0
Additional Labels
No response