SCREAMING_SNAKE_CASE
and UPPERCASE
names don't get flagged by module_name_repetitions
#13968
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-negative
Issue: The lint should have been triggered on code, but wasn't
Summary
While refactoring code to adhere to
module_name_repetitions
we noticed that our constants wouldn't get flagged.Example
This seems like it might be a bug, as I think the reasoning given in the lint description as well as the arguments given in the discussion around RFC #356 also apply to constants.
Cause
After doing some investigation this appears to be happening due to how
to_camel_case()
inclippy_utils::str_utils
handles uppercase input.rust-clippy/clippy_utils/src/str_utils.rs
Lines 270 to 277 in 894e87c
Because of the early return here the comparison between
item_camel
andmod_camel
initem_name_repetitions.rs
returns false and theSCREAMING_SNAKE_CASE
name doesn't get flagged by the lint.rust-clippy/clippy_lints/src/item_name_repetitions.rs
Lines 406 to 407 in 894e87c
rust-clippy/clippy_lints/src/item_name_repetitions.rs
Lines 430 to 431 in 894e87c
If this is a bug indeed and the behavior is not intentional I'd be happy to work on a fix and put in a pull-request!
Lint Name
module_name_repetitions
Reproducer
No response
Version
The text was updated successfully, but these errors were encountered: