From 9c53dcbf5e67de05a44a23ae57dc06ed35dd7fe6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:45:26 +0000 Subject: [PATCH 1/9] Initial plan From cca3dc1d83b3e4fd491f5d2a982c93bf87fa8fae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:50:29 +0000 Subject: [PATCH 2/9] Add initial renaming-table.md with 47 proposed lint renames Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 renaming-table.md diff --git a/renaming-table.md b/renaming-table.md new file mode 100644 index 000000000000..0d9b5a7a9d0d --- /dev/null +++ b/renaming-table.md @@ -0,0 +1,78 @@ +# Clippy Lint Renaming Table + +This document proposes renaming Clippy lints to better align with the Rust RFC 0344 naming conventions ([link](https://rust-lang.github.io/rfcs/0344-conventions-galore.html)). + +## Summary of Guidelines + +The RFC 0344 guidelines for lint naming state: + +1. **State the bad thing**: Lint names should state the bad thing being checked for (e.g., `deprecated`), so that `#[allow(deprecated)]` reads correctly. + +2. **Avoid redundant suffixes**: Lints that apply to arbitrary items should just mention what they check for (e.g., use `deprecated` rather than `deprecated_items`). + +3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). + +4. **Prefer 'unused' terminology**: Lints that catch unnecessary, unused, or useless aspects of code should use the term `unused` (e.g., `unused_imports`, `unused_typecasts`). + +5. **Use snake_case**: Use snake case consistently, as you would for function names. + +## Proposed Renames + +Total lints analyzed: 47 + +| Current Name | Proposed Name | Reason | +|--------------|---------------|--------| +| `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LIST` | Has redundant suffix '_items' (guideline 2) | +| `ITER_ON_SINGLE_ITEMS` | `ITER_ON_SINGLE` | Has redundant suffix '_items' (guideline 2) | +| `MISSING_DOCS_IN_PRIVATE_ITEMS` | `MISSING_DOCS_IN_PRIVATE` | Has redundant suffix '_items' (guideline 2) | +| `MISSING_INLINE_IN_PUBLIC_ITEMS` | `MISSING_INLINE_IN_PUBLIC` | Has redundant suffix '_items' (guideline 2) | +| `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPE` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOL` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BOOL` | `UNNECESSARY_BOOL` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BOOL_ASSIGN` | `UNNECESSARY_BOOL_ASSIGN` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BORROW` | `UNNECESSARY_BORROW` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BORROWED_REFERENCE` | `UNNECESSARY_BORROWED_REFERENCE` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BORROWS_FOR_GENERIC_ARGS` | `UNNECESSARY_BORROWS_FOR_GENERIC_ARGS` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_CHARACTER_ITERATION` | `UNNECESSARY_CHARACTER_ITERATION` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_COLLECT` | `UNNECESSARY_COLLECT` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_CONTINUE` | `UNNECESSARY_CONTINUE` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_DOCTEST_MAIN` | `UNNECESSARY_DOCTEST_MAIN` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_ELSE` | `UNNECESSARY_ELSE` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_FOR_EACH` | `UNNECESSARY_FOR_EACH` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_IFS` | `UNNECESSARY_IFS` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_LATE_INIT` | `UNNECESSARY_LATE_INIT` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_LIFETIMES` | `UNNECESSARY_LIFETIMES` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_MATCH` | `UNNECESSARY_MATCH` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_MAYBE_SIZED` | `UNNECESSARY_MAYBE_SIZED` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_OPTION_AS_DEREF` | `UNNECESSARY_OPTION_AS_DEREF` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_OPTION_TAKE` | `UNNECESSARY_OPTION_TAKE` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_PARENS_ON_RANGE_LITERALS` | `UNNECESSARY_PARENS_ON_RANGE_LITERALS` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_PASS_BY_REF_MUT` | `UNNECESSARY_PASS_BY_REF_MUT` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_PASS_BY_VALUE` | `UNNECESSARY_PASS_BY_VALUE` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_PUB_SELF` | `UNNECESSARY_PUB_SELF` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_QUESTION_MARK` | `UNNECESSARY_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_RANGE_LOOP` | `UNNECESSARY_RANGE_LOOP` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_RAW_STRINGS` | `UNNECESSARY_RAW_STRINGS` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_RAW_STRING_HASHES` | `UNNECESSARY_RAW_STRING_HASHES` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_RETURN` | `UNNECESSARY_RETURN` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_RETURN_WITH_QUESTION_MARK` | `UNNECESSARY_RETURN_WITH_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_SPLITN` | `UNNECESSARY_SPLITN` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_UPDATE` | `UNNECESSARY_UPDATE` | Uses 'needless' instead of 'unnecessary' | +| `USED_UNDERSCORE_ITEMS` | `USED_UNDERSCORE` | Has redundant suffix '_items' (guideline 2) | +| `USELESS_ASREF` | `UNUSED_ASREF` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTE` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_CONCAT` | `UNUSED_CONCAT` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_CONVERSION` | `UNUSED_CONVERSION` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_FORMAT` | `UNUSED_FORMAT` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_LET_IF_SEQ` | `UNUSED_LET_IF_SEQ` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_NONZERO_NEW_UNCHECKED` | `UNUSED_NONZERO_NEW_UNCHECKED` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTE` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_VEC` | `UNUSED_VEC` | Uses 'useless' instead of 'unused' (guideline 4) | + +## Implementation Notes + +- These are proposed renames only and require community discussion +- Actual implementation would require updating lint declarations, tests, and documentation +- Old lint names should be deprecated with clear migration paths +- Consider using lint group aliases to maintain backward compatibility From 8ba43aba01a22aa034b7f6fb1d2cf5cbdb7f3968 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:53:44 +0000 Subject: [PATCH 3/9] Enhance renaming-table.md with rationale, examples, and detailed breakdown Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 56 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/renaming-table.md b/renaming-table.md index 0d9b5a7a9d0d..bd4a366f7cbd 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -18,7 +18,11 @@ The RFC 0344 guidelines for lint naming state: ## Proposed Renames -Total lints analyzed: 47 +Out of 791 total Clippy lints analyzed, 47 lints were identified as not following RFC 0344 guidelines: + +- **33 lints** use 'needless' instead of 'unnecessary' +- **9 lints** use 'useless' instead of 'unused' +- **5 lints** have redundant '_items' suffix | Current Name | Proposed Name | Reason | |--------------|---------------|--------| @@ -70,9 +74,55 @@ Total lints analyzed: 47 | `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTE` | Uses 'useless' instead of 'unused' (guideline 4) | | `USELESS_VEC` | `UNUSED_VEC` | Uses 'useless' instead of 'unused' (guideline 4) | +## Rationale + +### Why 'needless' should be 'unnecessary' + +The RFC 0344 guidelines don't mention "needless" as a standard term. The guidelines specify: +- Use "unused" for things that are not used (e.g., `unused_imports`, `unused_variables`) +- The term "unnecessary" is more standard in technical writing + +For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_borrow)]`. + +### Why 'useless' should be 'unused' + +Per guideline 4, lints that catch "unnecessary, unused, or useless aspects of code should use the term `unused`". The term "useless" is colloquial and less precise than "unused". + +### Why '_items' suffix should be removed + +Per guideline 2, lints that apply to arbitrary items should just mention what they check for, keeping lint names short. For example, use `deprecated` rather than `deprecated_items`, as `#[allow(deprecated)]` items already reads correctly. + +## Examples + +Before: +```rust +#[allow(needless_borrow)] +fn foo(x: &str) { ... } + +#[allow(useless_conversion)] +let x: i32 = x.into(); + +#[allow(missing_docs_in_private_items)] +fn internal() { ... } +``` + +After: +```rust +#[allow(unnecessary_borrow)] +fn foo(x: &str) { ... } + +#[allow(unused_conversion)] +let x: i32 = x.into(); + +#[allow(missing_docs_in_private)] +fn internal() { ... } +``` + ## Implementation Notes - These are proposed renames only and require community discussion - Actual implementation would require updating lint declarations, tests, and documentation -- Old lint names should be deprecated with clear migration paths -- Consider using lint group aliases to maintain backward compatibility +- Old lint names should be deprecated with clear migration paths to avoid breaking existing code +- Consider using lint group aliases to maintain backward compatibility during transition period +- Update all documentation, including the Clippy book and online lint list +- Ensure rustfix suggestions work correctly with renamed lints From ce401e93a52cdf361aa9122e0d1d23fc337933e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:54:54 +0000 Subject: [PATCH 4/9] Clarify distinction between 'unused' and 'unnecessary' in rationale Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/renaming-table.md b/renaming-table.md index bd4a366f7cbd..377a9d59b400 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -80,9 +80,13 @@ Out of 791 total Clippy lints analyzed, 47 lints were identified as not followin The RFC 0344 guidelines don't mention "needless" as a standard term. The guidelines specify: - Use "unused" for things that are not used (e.g., `unused_imports`, `unused_variables`) -- The term "unnecessary" is more standard in technical writing +- The term "unnecessary" is more standard in technical writing for things that serve no purpose -For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_borrow)]`. +The distinction is subtle: +- "unused" = something that exists but is never used (e.g., an import that's never referenced) +- "unnecessary" = something that can be removed or simplified without changing behavior (e.g., an unnecessary borrow, an unnecessary return statement) + +For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_borrow)]` and is more precise: the borrow exists and may be used, but it's not necessary. ### Why 'useless' should be 'unused' From dd59b2bdb690dde29b083331b9b4ab46fb5a6c97 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 14:23:03 +0000 Subject: [PATCH 5/9] Add analysis notes on plural usage and suggest better names for 4 semantically unclear lints Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/renaming-table.md b/renaming-table.md index 377a9d59b400..8b23445559d5 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -16,6 +16,20 @@ The RFC 0344 guidelines for lint naming state: 5. **Use snake_case**: Use snake case consistently, as you would for function names. +## Analysis Notes + +### Plural Form Usage + +The analysis respects that some lint names are appropriately singular when they: +- Refer to a concept or pattern rather than specific instances (e.g., `dbg_macro`) +- Apply to arbitrary items without specifying a grammatical class +- Are already plural in their base form (e.g., `blocks_in_conditions`) + +Per guideline 3, pluralization is required when the lint applies to a specific grammatical class. For example: +- ✅ `unused_variables` - applies to the grammatical class of variables +- ✅ `dbg_macro` - refers to a macro pattern, not multiple macros +- ✅ `blocks_in_conditions` - already plural + ## Proposed Renames Out of 791 total Clippy lints analyzed, 47 lints were identified as not following RFC 0344 guidelines: @@ -74,6 +88,20 @@ Out of 791 total Clippy lints analyzed, 47 lints were identified as not followin | `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTE` | Uses 'useless' instead of 'unused' (guideline 4) | | `USELESS_VEC` | `UNUSED_VEC` | Uses 'useless' instead of 'unused' (guideline 4) | +## Lints Requiring Further Review + +The following lints may have names that don't clearly state the bad thing being checked for, or may be confusing: + +| Current Name | What it checks | Issue | Suggested Alternative | +|--------------|----------------|-------|----------------------| +| `ALLOW_ATTRIBUTES` | Usage of `#[allow]` instead of `#[expect]` | Name suggests allowing is bad, but the bad thing is missing expectations | Consider `MISSING_EXPECT_ATTRIBUTE` or `PREFER_EXPECT_OVER_ALLOW` | +| `ALLOW_ATTRIBUTES_WITHOUT_REASON` | `#[allow]` attributes without a reason parameter | Name is confusing with nested "allow" | Consider `MISSING_ALLOW_REASON` or `UNDOCUMENTED_ALLOW` | +| `USE_DEBUG` | Usage of Debug formatting in user-facing output | Name suggests positive action, bad thing is inappropriate Debug formatting | Consider `DEBUG_IN_USER_OUTPUT` or `INAPPROPRIATE_DEBUG_FMT` | +| `USE_SELF` | Unnecessary repetition of struct name instead of `Self` | Name suggests positive action, bad thing is unnecessary type repetition | Consider `UNNECESSARY_STRUCT_NAME` or `MISSING_SELF_USAGE` | + +**Note**: These suggestions aim to better align with guideline 1 (state the bad thing) while maintaining clarity about what the lint checks for. The current names either suggest positive actions or contain confusing terminology. + + ## Rationale ### Why 'needless' should be 'unnecessary' From 6f026ad76b803de9004a763b257edcd076b7c598 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 14:38:02 +0000 Subject: [PATCH 6/9] Fix _items suffix analysis: keep suffix when removal leaves adjective without noun Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/renaming-table.md b/renaming-table.md index 8b23445559d5..f419b68c55ae 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -8,7 +8,7 @@ The RFC 0344 guidelines for lint naming state: 1. **State the bad thing**: Lint names should state the bad thing being checked for (e.g., `deprecated`), so that `#[allow(deprecated)]` reads correctly. -2. **Avoid redundant suffixes**: Lints that apply to arbitrary items should just mention what they check for (e.g., use `deprecated` rather than `deprecated_items`). +2. **Avoid redundant suffixes**: Lints that apply to arbitrary items should just mention what they check for (e.g., use `deprecated` rather than `deprecated_items`). However, when removing a suffix would leave an adjective without a noun (e.g., `private_items` → `private`), the suffix should be retained for clarity. 3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). @@ -30,20 +30,24 @@ Per guideline 3, pluralization is required when the lint applies to a specific g - ✅ `dbg_macro` - refers to a macro pattern, not multiple macros - ✅ `blocks_in_conditions` - already plural +### Suffix Removal Considerations + +When considering removing suffixes like `_items`, it's important to ensure the resulting name is grammatically complete. Adjectives require nouns: +- ❌ `missing_docs_in_private` - 'private' is an adjective without a noun +- ✅ `missing_docs_in_private_items` - grammatically complete +- ✅ `doc_overindented_list` - 'list' is a noun, can remove '_items' + ## Proposed Renames -Out of 791 total Clippy lints analyzed, 47 lints were identified as not following RFC 0344 guidelines: +Out of 791 total Clippy lints analyzed, 44 lints were identified as not following RFC 0344 guidelines: - **33 lints** use 'needless' instead of 'unnecessary' - **9 lints** use 'useless' instead of 'unused' -- **5 lints** have redundant '_items' suffix +- **2 lints** have redundant '_items' suffix (where removal leaves a complete noun) | Current Name | Proposed Name | Reason | |--------------|---------------|--------| | `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LIST` | Has redundant suffix '_items' (guideline 2) | -| `ITER_ON_SINGLE_ITEMS` | `ITER_ON_SINGLE` | Has redundant suffix '_items' (guideline 2) | -| `MISSING_DOCS_IN_PRIVATE_ITEMS` | `MISSING_DOCS_IN_PRIVATE` | Has redundant suffix '_items' (guideline 2) | -| `MISSING_INLINE_IN_PUBLIC_ITEMS` | `MISSING_INLINE_IN_PUBLIC` | Has redundant suffix '_items' (guideline 2) | | `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPE` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOL` | Uses 'needless' instead of 'unnecessary' | @@ -120,10 +124,12 @@ For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_ Per guideline 4, lints that catch "unnecessary, unused, or useless aspects of code should use the term `unused`". The term "useless" is colloquial and less precise than "unused". -### Why '_items' suffix should be removed +### Why some '_items' suffixes should be removed Per guideline 2, lints that apply to arbitrary items should just mention what they check for, keeping lint names short. For example, use `deprecated` rather than `deprecated_items`, as `#[allow(deprecated)]` items already reads correctly. +However, the suffix must be retained when removing it would leave an adjective without a noun, such as `missing_docs_in_private_items` where "private" is an adjective modifying "items". Removing "_items" would result in `missing_docs_in_private`, which is grammatically incomplete. + ## Examples Before: @@ -134,8 +140,9 @@ fn foo(x: &str) { ... } #[allow(useless_conversion)] let x: i32 = x.into(); -#[allow(missing_docs_in_private_items)] -fn internal() { ... } +#[allow(doc_overindented_list_items)] +/// - item +fn documented() { ... } ``` After: @@ -146,8 +153,20 @@ fn foo(x: &str) { ... } #[allow(unused_conversion)] let x: i32 = x.into(); -#[allow(missing_docs_in_private)] -fn internal() { ... } +#[allow(doc_overindented_list)] // 'list' is a noun +/// - item +fn documented() { ... } +``` + +But keep the suffix when needed: +```rust +// Keep: 'private' is an adjective that needs 'items' +#[allow(missing_docs_in_private_items)] +mod internal { } + +// Keep: 'public' is an adjective that needs 'items' +#[allow(missing_inline_in_public_items)] +pub fn api() { } ``` ## Implementation Notes From 08f085938f6eaa13d7d311c3c958a48513217b74 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 14:47:05 +0000 Subject: [PATCH 7/9] Add pluralization analysis: 5 lints should use plural form (e.g., UNNECESSARY_BOOLS) Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 70 ++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/renaming-table.md b/renaming-table.md index f419b68c55ae..fd0d34a2cdf1 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -10,7 +10,7 @@ The RFC 0344 guidelines for lint naming state: 2. **Avoid redundant suffixes**: Lints that apply to arbitrary items should just mention what they check for (e.g., use `deprecated` rather than `deprecated_items`). However, when removing a suffix would leave an adjective without a noun (e.g., `private_items` → `private`), the suffix should be retained for clarity. -3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). +3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). This applies when the lint checks multiple instances of a specific type of item (e.g., multiple boolean expressions, multiple conversions). 4. **Prefer 'unused' terminology**: Lints that catch unnecessary, unused, or useless aspects of code should use the term `unused` (e.g., `unused_imports`, `unused_typecasts`). @@ -20,15 +20,16 @@ The RFC 0344 guidelines for lint naming state: ### Plural Form Usage -The analysis respects that some lint names are appropriately singular when they: -- Refer to a concept or pattern rather than specific instances (e.g., `dbg_macro`) -- Apply to arbitrary items without specifying a grammatical class -- Are already plural in their base form (e.g., `blocks_in_conditions`) +Per guideline 3, pluralization is required when the lint checks multiple instances of a specific grammatical class. Examples: +- ✅ `unused_variables` - checks multiple variable declarations +- ✅ `unnecessary_bools` - checks multiple boolean expressions/if-statements +- ✅ `unused_conversions` - checks multiple conversion calls +- ✅ `dbg_macro` - refers to a macro pattern/concept, appropriately singular +- ✅ `bool_comparison` - refers to the comparison pattern itself, appropriately singular -Per guideline 3, pluralization is required when the lint applies to a specific grammatical class. For example: -- ✅ `unused_variables` - applies to the grammatical class of variables -- ✅ `dbg_macro` - refers to a macro pattern, not multiple macros -- ✅ `blocks_in_conditions` - already plural +The key distinction: +- Use **plural** when the lint finds and reports multiple instances in code (e.g., "found 3 unnecessary boolean expressions") +- Use **singular** when the lint detects a pattern or concept (e.g., "this is a boolean comparison pattern") ### Suffix Removal Considerations @@ -39,19 +40,22 @@ When considering removing suffixes like `_items`, it's important to ensure the r ## Proposed Renames -Out of 791 total Clippy lints analyzed, 44 lints were identified as not following RFC 0344 guidelines: +Out of 791 total Clippy lints analyzed, 45 lints were identified as not following RFC 0344 guidelines: - **33 lints** use 'needless' instead of 'unnecessary' - **9 lints** use 'useless' instead of 'unused' - **2 lints** have redundant '_items' suffix (where removal leaves a complete noun) +- **5 lints** should use plural form for specific grammatical classes + +Note: Some lints have multiple issues (e.g., `NEEDLESS_BOOL` → `UNNECESSARY_BOOLS` addresses both 'needless' and pluralization), so categories overlap. | Current Name | Proposed Name | Reason | |--------------|---------------|--------| | `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LIST` | Has redundant suffix '_items' (guideline 2) | | `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPE` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOL` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_BOOL` | `UNNECESSARY_BOOL` | Uses 'needless' instead of 'unnecessary' | +| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural form (checks multiple boolean expressions) | +| `NEEDLESS_BOOL` | `UNNECESSARY_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural form (checks multiple if-statements with booleans) | | `NEEDLESS_BOOL_ASSIGN` | `UNNECESSARY_BOOL_ASSIGN` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_BORROW` | `UNNECESSARY_BORROW` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_BORROWED_REFERENCE` | `UNNECESSARY_BORROWED_REFERENCE` | Uses 'needless' instead of 'unnecessary' | @@ -81,11 +85,12 @@ Out of 791 total Clippy lints analyzed, 44 lints were identified as not followin | `NEEDLESS_RETURN_WITH_QUESTION_MARK` | `UNNECESSARY_RETURN_WITH_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_SPLITN` | `UNNECESSARY_SPLITN` | Uses 'needless' instead of 'unnecessary' | | `NEEDLESS_UPDATE` | `UNNECESSARY_UPDATE` | Uses 'needless' instead of 'unnecessary' | +| `NONMINIMAL_BOOL` | `NONMINIMAL_BOOLS` | Should use plural form (guideline 3) - checks multiple boolean expressions | | `USED_UNDERSCORE_ITEMS` | `USED_UNDERSCORE` | Has redundant suffix '_items' (guideline 2) | | `USELESS_ASREF` | `UNUSED_ASREF` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTE` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTES` | Uses 'useless' instead of 'unused' (guideline 4); should use plural form (checks multiple attributes) | | `USELESS_CONCAT` | `UNUSED_CONCAT` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_CONVERSION` | `UNUSED_CONVERSION` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USELESS_CONVERSION` | `UNUSED_CONVERSIONS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural form (checks multiple conversion calls) | | `USELESS_FORMAT` | `UNUSED_FORMAT` | Uses 'useless' instead of 'unused' (guideline 4) | | `USELESS_LET_IF_SEQ` | `UNUSED_LET_IF_SEQ` | Uses 'useless' instead of 'unused' (guideline 4) | | `USELESS_NONZERO_NEW_UNCHECKED` | `UNUSED_NONZERO_NEW_UNCHECKED` | Uses 'useless' instead of 'unused' (guideline 4) | @@ -103,7 +108,7 @@ The following lints may have names that don't clearly state the bad thing being | `USE_DEBUG` | Usage of Debug formatting in user-facing output | Name suggests positive action, bad thing is inappropriate Debug formatting | Consider `DEBUG_IN_USER_OUTPUT` or `INAPPROPRIATE_DEBUG_FMT` | | `USE_SELF` | Unnecessary repetition of struct name instead of `Self` | Name suggests positive action, bad thing is unnecessary type repetition | Consider `UNNECESSARY_STRUCT_NAME` or `MISSING_SELF_USAGE` | -**Note**: These suggestions aim to better align with guideline 1 (state the bad thing) while maintaining clarity about what the lint checks for. The current names either suggest positive actions or contain confusing terminology. +**Note**: These suggestions aim to better align with guideline 1 (state the bad thing) while maintaining clarity about what the lint checks for. ## Rationale @@ -118,26 +123,33 @@ The distinction is subtle: - "unused" = something that exists but is never used (e.g., an import that's never referenced) - "unnecessary" = something that can be removed or simplified without changing behavior (e.g., an unnecessary borrow, an unnecessary return statement) -For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_borrow)]` and is more precise: the borrow exists and may be used, but it's not necessary. +For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_borrow)]`. ### Why 'useless' should be 'unused' Per guideline 4, lints that catch "unnecessary, unused, or useless aspects of code should use the term `unused`". The term "useless" is colloquial and less precise than "unused". -### Why some '_items' suffixes should be removed +### Why plural forms matter + +Per guideline 3, when a lint checks multiple instances of a specific grammatical class, it should use the plural form. This makes `#[allow(unnecessary_bools)]` read correctly as "allow unnecessary bools" when the lint checks for multiple boolean expressions or if-statements with boolean values. -Per guideline 2, lints that apply to arbitrary items should just mention what they check for, keeping lint names short. For example, use `deprecated` rather than `deprecated_items`, as `#[allow(deprecated)]` items already reads correctly. +Examples: +- `NEEDLESS_BOOL` checks "if-statements with plain booleans" → `UNNECESSARY_BOOLS` +- `USELESS_CONVERSION` checks "calls to Into/From" → `UNUSED_CONVERSIONS` +- `USELESS_ATTRIBUTE` checks "lint attributes" → `UNUSED_ATTRIBUTES` -However, the suffix must be retained when removing it would leave an adjective without a noun, such as `missing_docs_in_private_items` where "private" is an adjective modifying "items". Removing "_items" would result in `missing_docs_in_private`, which is grammatically incomplete. +### Why some '_items' suffixes should be removed + +Per guideline 2, lints that apply to arbitrary items should just mention what they check for, keeping lint names short. However, the suffix must be retained when removing it would leave an adjective without a noun. ## Examples Before: ```rust -#[allow(needless_borrow)] -fn foo(x: &str) { ... } +#[allow(needless_bool)] // Checks multiple if-statements +if x { true } else { false } -#[allow(useless_conversion)] +#[allow(useless_conversion)] // Checks multiple conversion calls let x: i32 = x.into(); #[allow(doc_overindented_list_items)] @@ -147,26 +159,22 @@ fn documented() { ... } After: ```rust -#[allow(unnecessary_borrow)] -fn foo(x: &str) { ... } +#[allow(unnecessary_bools)] // Plural: checks multiple if-statements +if x { true } else { false } -#[allow(unused_conversion)] +#[allow(unused_conversions)] // Plural: checks multiple calls let x: i32 = x.into(); -#[allow(doc_overindented_list)] // 'list' is a noun +#[allow(doc_overindented_list)] // 'list' is a noun, suffix removed /// - item fn documented() { ... } ``` -But keep the suffix when needed: +Keep the suffix when needed: ```rust // Keep: 'private' is an adjective that needs 'items' #[allow(missing_docs_in_private_items)] mod internal { } - -// Keep: 'public' is an adjective that needs 'items' -#[allow(missing_inline_in_public_items)] -pub fn api() { } ``` ## Implementation Notes From 0e7cc4dcec0374b02c3253552ca258fced335e7e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 14:57:57 +0000 Subject: [PATCH 8/9] Apply comprehensive pluralization: all renamed lints now use plural forms Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 229 ++++++++++++++++++++++------------------------ 1 file changed, 107 insertions(+), 122 deletions(-) diff --git a/renaming-table.md b/renaming-table.md index fd0d34a2cdf1..97923f483d9e 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -10,178 +10,163 @@ The RFC 0344 guidelines for lint naming state: 2. **Avoid redundant suffixes**: Lints that apply to arbitrary items should just mention what they check for (e.g., use `deprecated` rather than `deprecated_items`). However, when removing a suffix would leave an adjective without a noun (e.g., `private_items` → `private`), the suffix should be retained for clarity. -3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). This applies when the lint checks multiple instances of a specific type of item (e.g., multiple boolean expressions, multiple conversions). +3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). **This document takes an aggressive approach to pluralization**: all lints are pluralized unless they refer to concepts, patterns, or macros rather than countable instances. 4. **Prefer 'unused' terminology**: Lints that catch unnecessary, unused, or useless aspects of code should use the term `unused` (e.g., `unused_imports`, `unused_typecasts`). 5. **Use snake_case**: Use snake case consistently, as you would for function names. -## Analysis Notes +## Pluralization Philosophy -### Plural Form Usage +This document applies pluralization comprehensively. The principle is: -Per guideline 3, pluralization is required when the lint checks multiple instances of a specific grammatical class. Examples: -- ✅ `unused_variables` - checks multiple variable declarations -- ✅ `unnecessary_bools` - checks multiple boolean expressions/if-statements -- ✅ `unused_conversions` - checks multiple conversion calls -- ✅ `dbg_macro` - refers to a macro pattern/concept, appropriately singular -- ✅ `bool_comparison` - refers to the comparison pattern itself, appropriately singular - -The key distinction: -- Use **plural** when the lint finds and reports multiple instances in code (e.g., "found 3 unnecessary boolean expressions") -- Use **singular** when the lint detects a pattern or concept (e.g., "this is a boolean comparison pattern") - -### Suffix Removal Considerations - -When considering removing suffixes like `_items`, it's important to ensure the resulting name is grammatically complete. Adjectives require nouns: -- ❌ `missing_docs_in_private` - 'private' is an adjective without a noun -- ✅ `missing_docs_in_private_items` - grammatically complete -- ✅ `doc_overindented_list` - 'list' is a noun, can remove '_items' +- **Use plural** when a lint can find and report multiple instances in code (e.g., multiple borrows, multiple returns, multiple conversions) +- **Use singular** only for: + - Macros (e.g., `dbg_macro` - refers to the macro itself) + - Traits (e.g., `default_trait_access` - refers to the trait) + - Patterns/concepts (e.g., `bool_comparison` - the comparison pattern) + - Ordering/style concepts (e.g., `module_style`, `arbitrary_source_item_ordering`) + - Mathematical concepts (e.g., `cognitive_complexity`) ## Proposed Renames -Out of 791 total Clippy lints analyzed, 45 lints were identified as not following RFC 0344 guidelines: +Out of 791 total Clippy lints analyzed, 45 lints were identified as not following RFC 0344 guidelines. -- **33 lints** use 'needless' instead of 'unnecessary' -- **9 lints** use 'useless' instead of 'unused' -- **2 lints** have redundant '_items' suffix (where removal leaves a complete noun) -- **5 lints** should use plural form for specific grammatical classes - -Note: Some lints have multiple issues (e.g., `NEEDLESS_BOOL` → `UNNECESSARY_BOOLS` addresses both 'needless' and pluralization), so categories overlap. +- **33 lints** use 'needless' instead of 'unnecessary' (all with pluralization) +- **9 lints** use 'useless' instead of 'unused' (all with pluralization) +- **2 lints** have redundant '_items' suffix (removed with pluralization) +- **Additional pluralization** applied to all renamed lints per guideline 3 | Current Name | Proposed Name | Reason | |--------------|---------------|--------| -| `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LIST` | Has redundant suffix '_items' (guideline 2) | -| `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPE` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural form (checks multiple boolean expressions) | -| `NEEDLESS_BOOL` | `UNNECESSARY_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural form (checks multiple if-statements with booleans) | -| `NEEDLESS_BOOL_ASSIGN` | `UNNECESSARY_BOOL_ASSIGN` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_BORROW` | `UNNECESSARY_BORROW` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_BORROWED_REFERENCE` | `UNNECESSARY_BORROWED_REFERENCE` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_BORROWS_FOR_GENERIC_ARGS` | `UNNECESSARY_BORROWS_FOR_GENERIC_ARGS` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_CHARACTER_ITERATION` | `UNNECESSARY_CHARACTER_ITERATION` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_COLLECT` | `UNNECESSARY_COLLECT` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_CONTINUE` | `UNNECESSARY_CONTINUE` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_DOCTEST_MAIN` | `UNNECESSARY_DOCTEST_MAIN` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_ELSE` | `UNNECESSARY_ELSE` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_FOR_EACH` | `UNNECESSARY_FOR_EACH` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_IFS` | `UNNECESSARY_IFS` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_LATE_INIT` | `UNNECESSARY_LATE_INIT` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_LIFETIMES` | `UNNECESSARY_LIFETIMES` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_MATCH` | `UNNECESSARY_MATCH` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_MAYBE_SIZED` | `UNNECESSARY_MAYBE_SIZED` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_OPTION_AS_DEREF` | `UNNECESSARY_OPTION_AS_DEREF` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_OPTION_TAKE` | `UNNECESSARY_OPTION_TAKE` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_PARENS_ON_RANGE_LITERALS` | `UNNECESSARY_PARENS_ON_RANGE_LITERALS` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_PASS_BY_REF_MUT` | `UNNECESSARY_PASS_BY_REF_MUT` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_PASS_BY_VALUE` | `UNNECESSARY_PASS_BY_VALUE` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_PUB_SELF` | `UNNECESSARY_PUB_SELF` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_QUESTION_MARK` | `UNNECESSARY_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_RANGE_LOOP` | `UNNECESSARY_RANGE_LOOP` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_RAW_STRINGS` | `UNNECESSARY_RAW_STRINGS` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_RAW_STRING_HASHES` | `UNNECESSARY_RAW_STRING_HASHES` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_RETURN` | `UNNECESSARY_RETURN` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_RETURN_WITH_QUESTION_MARK` | `UNNECESSARY_RETURN_WITH_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_SPLITN` | `UNNECESSARY_SPLITN` | Uses 'needless' instead of 'unnecessary' | -| `NEEDLESS_UPDATE` | `UNNECESSARY_UPDATE` | Uses 'needless' instead of 'unnecessary' | +| `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LISTS` | Has redundant suffix '_items' (guideline 2); should use plural | +| `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple type usages) | +| `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple conversions) | +| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple boolean expressions) | +| `NEEDLESS_BOOL` | `UNNECESSARY_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple if-statements with booleans) | +| `NEEDLESS_BOOL_ASSIGN` | `UNNECESSARY_BOOL_ASSIGNS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple assignments) | +| `NEEDLESS_BORROW` | `UNNECESSARY_BORROWS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple borrow expressions) | +| `NEEDLESS_BORROWED_REFERENCE` | `UNNECESSARY_BORROWED_REFERENCES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple references) | +| `NEEDLESS_BORROWS_FOR_GENERIC_ARGS` | `UNNECESSARY_BORROWS_FOR_GENERIC_ARGS` | Uses 'needless' instead of 'unnecessary' (already plural) | +| `NEEDLESS_CHARACTER_ITERATION` | `UNNECESSARY_CHARACTER_ITERATIONS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple iterations) | +| `NEEDLESS_COLLECT` | `UNNECESSARY_COLLECTS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple collect calls) | +| `NEEDLESS_CONTINUE` | `UNNECESSARY_CONTINUES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple continue statements) | +| `NEEDLESS_DOCTEST_MAIN` | `UNNECESSARY_DOCTEST_MAINS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple doctests) | +| `NEEDLESS_ELSE` | `UNNECESSARY_ELSES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple else blocks) | +| `NEEDLESS_FOR_EACH` | `UNNECESSARY_FOR_EACHES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple for_each calls) | +| `NEEDLESS_IFS` | `UNNECESSARY_IFS` | Uses 'needless' instead of 'unnecessary' (already plural) | +| `NEEDLESS_LATE_INIT` | `UNNECESSARY_LATE_INITS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple initializations) | +| `NEEDLESS_LIFETIMES` | `UNNECESSARY_LIFETIMES` | Uses 'needless' instead of 'unnecessary' (already plural) | +| `NEEDLESS_MATCH` | `UNNECESSARY_MATCHES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple match expressions) | +| `NEEDLESS_MAYBE_SIZED` | `UNNECESSARY_MAYBE_SIZEDS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple bounds) | +| `NEEDLESS_OPTION_AS_DEREF` | `UNNECESSARY_OPTION_AS_DEREFS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple method calls) | +| `NEEDLESS_OPTION_TAKE` | `UNNECESSARY_OPTION_TAKES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple take calls) | +| `NEEDLESS_PARENS_ON_RANGE_LITERALS` | `UNNECESSARY_PARENS_ON_RANGE_LITERALS` | Uses 'needless' instead of 'unnecessary' (already plural) | +| `NEEDLESS_PASS_BY_REF_MUT` | `UNNECESSARY_PASS_BY_REF_MUTS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple parameters) | +| `NEEDLESS_PASS_BY_VALUE` | `UNNECESSARY_PASS_BY_VALUES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple parameters) | +| `NEEDLESS_PUB_SELF` | `UNNECESSARY_PUB_SELFS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple visibility modifiers) | +| `NEEDLESS_QUESTION_MARK` | `UNNECESSARY_QUESTION_MARKS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple uses) | +| `NEEDLESS_RANGE_LOOP` | `UNNECESSARY_RANGE_LOOPS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple loops) | +| `NEEDLESS_RAW_STRINGS` | `UNNECESSARY_RAW_STRINGS` | Uses 'needless' instead of 'unnecessary' (already plural) | +| `NEEDLESS_RAW_STRING_HASHES` | `UNNECESSARY_RAW_STRING_HASHES` | Uses 'needless' instead of 'unnecessary' (already plural) | +| `NEEDLESS_RETURN` | `UNNECESSARY_RETURNS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple return statements) | +| `NEEDLESS_RETURN_WITH_QUESTION_MARK` | `UNNECESSARY_RETURNS_WITH_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple returns) | +| `NEEDLESS_SPLITN` | `UNNECESSARY_SPLITNS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple splitn calls) | +| `NEEDLESS_UPDATE` | `UNNECESSARY_UPDATES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple struct updates) | | `NONMINIMAL_BOOL` | `NONMINIMAL_BOOLS` | Should use plural form (guideline 3) - checks multiple boolean expressions | -| `USED_UNDERSCORE_ITEMS` | `USED_UNDERSCORE` | Has redundant suffix '_items' (guideline 2) | -| `USELESS_ASREF` | `UNUSED_ASREF` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTES` | Uses 'useless' instead of 'unused' (guideline 4); should use plural form (checks multiple attributes) | -| `USELESS_CONCAT` | `UNUSED_CONCAT` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_CONVERSION` | `UNUSED_CONVERSIONS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural form (checks multiple conversion calls) | -| `USELESS_FORMAT` | `UNUSED_FORMAT` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_LET_IF_SEQ` | `UNUSED_LET_IF_SEQ` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_NONZERO_NEW_UNCHECKED` | `UNUSED_NONZERO_NEW_UNCHECKED` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTE` | Uses 'useless' instead of 'unused' (guideline 4) | -| `USELESS_VEC` | `UNUSED_VEC` | Uses 'useless' instead of 'unused' (guideline 4) | +| `USED_UNDERSCORE_ITEMS` | `USED_UNDERSCORES` | Has redundant suffix '_items' (guideline 2); should use plural | +| `USELESS_ASREF` | `UNUSED_ASREFS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple as_ref calls) | +| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTES` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple attributes) | +| `USELESS_CONCAT` | `UNUSED_CONCATS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple concat calls) | +| `USELESS_CONVERSION` | `UNUSED_CONVERSIONS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple conversion calls) | +| `USELESS_FORMAT` | `UNUSED_FORMATS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple format calls) | +| `USELESS_LET_IF_SEQ` | `UNUSED_LET_IF_SEQS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple patterns) | +| `USELESS_NONZERO_NEW_UNCHECKED` | `UNUSED_NONZERO_NEW_UNCHECKEDS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple calls) | +| `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTES` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple transmute calls) | +| `USELESS_VEC` | `UNUSED_VECS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple vec constructions) | + +## Lints Kept Singular (Examples) + +The following categories of lints are appropriately kept singular: + +### Macros +- `DBG_MACRO` - refers to the `dbg!` macro itself +- `TODO_MACRO` - refers to the `todo!` macro itself +- `PRINT_LITERAL` - refers to printing pattern + +### Traits +- `DEFAULT_TRAIT_ACCESS` - refers to the `Default` trait +- `FUTURE_NOT_SEND` - refers to the `Send` trait bound + +### Patterns and Concepts +- `BOOL_COMPARISON` - refers to the comparison pattern +- `MODULE_STYLE` - refers to module organization style +- `ARBITRARY_SOURCE_ITEM_ORDERING` - refers to ordering concept +- `COGNITIVE_COMPLEXITY` - refers to complexity metric ## Lints Requiring Further Review -The following lints may have names that don't clearly state the bad thing being checked for, or may be confusing: +The following lints may have names that don't clearly state the bad thing being checked for: | Current Name | What it checks | Issue | Suggested Alternative | |--------------|----------------|-------|----------------------| -| `ALLOW_ATTRIBUTES` | Usage of `#[allow]` instead of `#[expect]` | Name suggests allowing is bad, but the bad thing is missing expectations | Consider `MISSING_EXPECT_ATTRIBUTE` or `PREFER_EXPECT_OVER_ALLOW` | -| `ALLOW_ATTRIBUTES_WITHOUT_REASON` | `#[allow]` attributes without a reason parameter | Name is confusing with nested "allow" | Consider `MISSING_ALLOW_REASON` or `UNDOCUMENTED_ALLOW` | -| `USE_DEBUG` | Usage of Debug formatting in user-facing output | Name suggests positive action, bad thing is inappropriate Debug formatting | Consider `DEBUG_IN_USER_OUTPUT` or `INAPPROPRIATE_DEBUG_FMT` | -| `USE_SELF` | Unnecessary repetition of struct name instead of `Self` | Name suggests positive action, bad thing is unnecessary type repetition | Consider `UNNECESSARY_STRUCT_NAME` or `MISSING_SELF_USAGE` | +| `ALLOW_ATTRIBUTES` | Usage of `#[allow]` instead of `#[expect]` | Name suggests allowing is bad, but the bad thing is missing expectations | Consider `MISSING_EXPECT_ATTRIBUTES` or `PREFER_EXPECT_OVER_ALLOW` | +| `ALLOW_ATTRIBUTES_WITHOUT_REASON` | `#[allow]` attributes without a reason parameter | Name is confusing with nested "allow" | Consider `MISSING_ALLOW_REASONS` or `UNDOCUMENTED_ALLOWS` | +| `USE_DEBUG` | Usage of Debug formatting in user-facing output | Name suggests positive action, bad thing is inappropriate Debug formatting | Consider `DEBUG_IN_USER_OUTPUTS` or `INAPPROPRIATE_DEBUG_FMTS` | +| `USE_SELF` | Unnecessary repetition of struct name instead of `Self` | Name suggests positive action, bad thing is unnecessary type repetition | Consider `UNNECESSARY_STRUCT_NAMES` or `MISSING_SELF_USAGES` | -**Note**: These suggestions aim to better align with guideline 1 (state the bad thing) while maintaining clarity about what the lint checks for. +**Note**: These suggestions use plural forms consistent with the pluralization philosophy. ## Rationale ### Why 'needless' should be 'unnecessary' -The RFC 0344 guidelines don't mention "needless" as a standard term. The guidelines specify: -- Use "unused" for things that are not used (e.g., `unused_imports`, `unused_variables`) -- The term "unnecessary" is more standard in technical writing for things that serve no purpose - -The distinction is subtle: -- "unused" = something that exists but is never used (e.g., an import that's never referenced) -- "unnecessary" = something that can be removed or simplified without changing behavior (e.g., an unnecessary borrow, an unnecessary return statement) - -For example, `#[allow(unnecessary_borrow)]` reads better than `#[allow(needless_borrow)]`. +The RFC 0344 guidelines don't mention "needless" as a standard term. The term "unnecessary" is more standard in technical writing. ### Why 'useless' should be 'unused' -Per guideline 4, lints that catch "unnecessary, unused, or useless aspects of code should use the term `unused`". The term "useless" is colloquial and less precise than "unused". +Per guideline 4, lints that catch "unnecessary, unused, or useless aspects of code should use the term `unused`". -### Why plural forms matter +### Why aggressive pluralization -Per guideline 3, when a lint checks multiple instances of a specific grammatical class, it should use the plural form. This makes `#[allow(unnecessary_bools)]` read correctly as "allow unnecessary bools" when the lint checks for multiple boolean expressions or if-statements with boolean values. +Per guideline 3, when a lint checks multiple instances of a specific grammatical class, it should use the plural form. Since most lints can find multiple occurrences in code, plural forms are more accurate. For example: +- `UNNECESSARY_BORROWS` - a codebase can have many unnecessary borrows +- `UNNECESSARY_RETURNS` - a function can have multiple unnecessary return statements +- `UNUSED_CONVERSIONS` - code can contain multiple unused conversion calls -Examples: -- `NEEDLESS_BOOL` checks "if-statements with plain booleans" → `UNNECESSARY_BOOLS` -- `USELESS_CONVERSION` checks "calls to Into/From" → `UNUSED_CONVERSIONS` -- `USELESS_ATTRIBUTE` checks "lint attributes" → `UNUSED_ATTRIBUTES` - -### Why some '_items' suffixes should be removed - -Per guideline 2, lints that apply to arbitrary items should just mention what they check for, keeping lint names short. However, the suffix must be retained when removing it would leave an adjective without a noun. +This makes `#[allow(unnecessary_borrows)]` read as "allow (multiple) unnecessary borrows" which is more accurate than the singular form. ## Examples Before: ```rust -#[allow(needless_bool)] // Checks multiple if-statements -if x { true } else { false } +#[allow(needless_borrow)] // Singular +let x = &value; -#[allow(useless_conversion)] // Checks multiple conversion calls -let x: i32 = x.into(); +#[allow(needless_return)] // Singular +fn foo() -> i32 { return 42; } -#[allow(doc_overindented_list_items)] -/// - item -fn documented() { ... } +#[allow(useless_conversion)] // Singular +let x: i32 = value.into(); ``` After: ```rust -#[allow(unnecessary_bools)] // Plural: checks multiple if-statements -if x { true } else { false } +#[allow(unnecessary_borrows)] // Plural - can have multiple +let x = &value; -#[allow(unused_conversions)] // Plural: checks multiple calls -let x: i32 = x.into(); +#[allow(unnecessary_returns)] // Plural - can have multiple +fn foo() -> i32 { return 42; } -#[allow(doc_overindented_list)] // 'list' is a noun, suffix removed -/// - item -fn documented() { ... } -``` - -Keep the suffix when needed: -```rust -// Keep: 'private' is an adjective that needs 'items' -#[allow(missing_docs_in_private_items)] -mod internal { } +#[allow(unused_conversions)] // Plural - can have multiple +let x: i32 = value.into(); ``` ## Implementation Notes - These are proposed renames only and require community discussion - Actual implementation would require updating lint declarations, tests, and documentation -- Old lint names should be deprecated with clear migration paths to avoid breaking existing code -- Consider using lint group aliases to maintain backward compatibility during transition period -- Update all documentation, including the Clippy book and online lint list -- Ensure rustfix suggestions work correctly with renamed lints +- Old lint names should be deprecated with clear migration paths +- Consider using lint group aliases for backward compatibility +- Update all documentation, including the Clippy book From 8abe0fad03394fadc34dea8d190e94c3e2a333db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 17:39:31 +0000 Subject: [PATCH 9/9] Add 154 noun-based pluralizations: comprehensive analysis of all lints Co-authored-by: samueltardieu <44656+samueltardieu@users.noreply.github.com> --- renaming-table.md | 297 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 224 insertions(+), 73 deletions(-) diff --git a/renaming-table.md b/renaming-table.md index 97923f483d9e..d6ce42f0e69f 100644 --- a/renaming-table.md +++ b/renaming-table.md @@ -10,7 +10,7 @@ The RFC 0344 guidelines for lint naming state: 2. **Avoid redundant suffixes**: Lints that apply to arbitrary items should just mention what they check for (e.g., use `deprecated` rather than `deprecated_items`). However, when removing a suffix would leave an adjective without a noun (e.g., `private_items` → `private`), the suffix should be retained for clarity. -3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). **This document takes an aggressive approach to pluralization**: all lints are pluralized unless they refer to concepts, patterns, or macros rather than countable instances. +3. **Use plural for specific classes**: If a lint applies to a specific grammatical class, mention that class and use the plural form (e.g., `unused_variables` rather than `unused_variable`). This document applies pluralization to all lint names ending in countable nouns, except those with convincing arguments to stay singular. 4. **Prefer 'unused' terminology**: Lints that catch unnecessary, unused, or useless aspects of code should use the term `unused` (e.g., `unused_imports`, `unused_typecasts`). @@ -18,72 +18,229 @@ The RFC 0344 guidelines for lint naming state: ## Pluralization Philosophy -This document applies pluralization comprehensively. The principle is: +This document applies pluralization comprehensively to all lint names ending in countable nouns. The principle is: -- **Use plural** when a lint can find and report multiple instances in code (e.g., multiple borrows, multiple returns, multiple conversions) +- **Use plural** when the last word is a countable noun and the lint can find multiple instances - **Use singular** only for: - Macros (e.g., `dbg_macro` - refers to the macro itself) - - Traits (e.g., `default_trait_access` - refers to the trait) - - Patterns/concepts (e.g., `bool_comparison` - the comparison pattern) - - Ordering/style concepts (e.g., `module_style`, `arbitrary_source_item_ordering`) + - Traits (e.g., `default_trait_access` - refers to the trait concept) + - Patterns/concepts (e.g., `assign_op_pattern` - the pattern itself) + - Style/ordering/convention concepts - Mathematical concepts (e.g., `cognitive_complexity`) + - Configuration concepts (e.g., `cargo_common_metadata`) + +**Note**: Pluralization is only applied when grammatically correct - the last significant word must be a noun, not a verb or adjective. ## Proposed Renames -Out of 791 total Clippy lints analyzed, 45 lints were identified as not following RFC 0344 guidelines. +Out of 791 total Clippy lints analyzed, 199 lints were identified as not following RFC 0344 guidelines. -- **33 lints** use 'needless' instead of 'unnecessary' (all with pluralization) -- **9 lints** use 'useless' instead of 'unused' (all with pluralization) +- **33 lints** use 'needless' instead of 'unnecessary' (all with plural forms) +- **9 lints** use 'useless' instead of 'unused' (all with plural forms) - **2 lints** have redundant '_items' suffix (removed with pluralization) -- **Additional pluralization** applied to all renamed lints per guideline 3 +- **154 additional lints** need pluralization (noun endings) | Current Name | Proposed Name | Reason | |--------------|---------------|--------| -| `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LISTS` | Has redundant suffix '_items' (guideline 2); should use plural | -| `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple type usages) | -| `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple conversions) | -| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple boolean expressions) | -| `NEEDLESS_BOOL` | `UNNECESSARY_BOOLS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple if-statements with booleans) | -| `NEEDLESS_BOOL_ASSIGN` | `UNNECESSARY_BOOL_ASSIGNS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple assignments) | -| `NEEDLESS_BORROW` | `UNNECESSARY_BORROWS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple borrow expressions) | -| `NEEDLESS_BORROWED_REFERENCE` | `UNNECESSARY_BORROWED_REFERENCES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple references) | +| `ALMOST_COMPLETE_RANGE` | `ALMOST_COMPLETE_RANGES` | Should use plural form (guideline 3) - 'range' is a countable noun | +| `APPROX_CONSTANT` | `APPROX_CONSTANTS` | Should use plural form (guideline 3) - 'constant' is a countable noun | +| `AWAIT_HOLDING_INVALID_TYPE` | `AWAIT_HOLDING_INVALID_TYPES` | Should use plural form (guideline 3) - 'type' is a countable noun | +| `AWAIT_HOLDING_LOCK` | `AWAIT_HOLDING_LOCKS` | Should use plural form (guideline 3) - 'lock' is a countable noun | +| `AWAIT_HOLDING_REFCELL_REF` | `AWAIT_HOLDING_REFCELL_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `BAD_BIT_MASK` | `BAD_BIT_MASKS` | Should use plural form (guideline 3) - 'mask' is a countable noun | +| `BOOL_ASSERT_COMPARISON` | `BOOL_ASSERT_COMPARISONS` | Should use plural form (guideline 3) - 'comparison' is a countable noun | +| `BOOL_COMPARISON` | `BOOL_COMPARISONS` | Should use plural form (guideline 3) - 'comparison' is a countable noun | +| `BORROWED_BOX` | `BORROWED_BOXES` | Should use plural form (guideline 3) - 'box' is a countable noun | +| `BORROW_AS_PTR` | `BORROW_AS_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `BORROW_DEREF_REF` | `BORROW_DEREF_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `BORROW_INTERIOR_MUTABLE_CONST` | `BORROW_INTERIOR_MUTABLE_CONSTS` | Should use plural form (guideline 3) - 'const' is a countable noun | +| `BOXED_LOCAL` | `BOXED_LOCALS` | Should use plural form (guideline 3) - 'local' is a countable noun | +| `BOX_COLLECTION` | `BOX_COLLECTIONS` | Should use plural form (guideline 3) - 'collection' is a countable noun | +| `CAST_ENUM_CONSTRUCTOR` | `CAST_ENUM_CONSTRUCTORS` | Should use plural form (guideline 3) - 'constructor' is a countable noun | +| `CAST_ENUM_TRUNCATION` | `CAST_ENUM_TRUNCATIONS` | Should use plural form (guideline 3) - 'truncation' is a countable noun | +| `CAST_POSSIBLE_TRUNCATION` | `CAST_POSSIBLE_TRUNCATIONS` | Should use plural form (guideline 3) - 'truncation' is a countable noun | +| `CAST_PRECISION_LOSS` | `CAST_PRECISION_LOSSES` | Should use plural form (guideline 3) - 'loss' is a countable noun | +| `CAST_PTR_ALIGNMENT` | `CAST_PTR_ALIGNMENTS` | Should use plural form (guideline 3) - 'alignment' is a countable noun | +| `CAST_SIGN_LOSS` | `CAST_SIGN_LOSSES` | Should use plural form (guideline 3) - 'loss' is a countable noun | +| `CLONE_ON_REF_PTR` | `CLONE_ON_REF_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `COLLAPSIBLE_MATCH` | `COLLAPSIBLE_MATCHES` | Should use plural form (guideline 3) - 'match' is a countable noun | +| `CONFUSING_METHOD_TO_NUMERIC_CAST` | `CONFUSING_METHOD_TO_NUMERIC_CASTS` | Should use plural form (guideline 3) - 'cast' is a countable noun | +| `COPY_ITERATOR` | `COPY_ITERATORS` | Should use plural form (guideline 3) - 'iterator' is a countable noun | +| `CREATE_DIR` | `CREATE_DIRS` | Should use plural form (guideline 3) - 'dir' is a countable noun | +| `CROSSPOINTER_TRANSMUTE` | `CROSSPOINTER_TRANSMUTES` | Should use plural form (guideline 3) - 'transmute' is a countable noun | +| `DEBUG_ASSERT_WITH_MUT_CALL` | `DEBUG_ASSERT_WITH_MUT_CALLS` | Should use plural form (guideline 3) - 'call' is a countable noun | +| `DECIMAL_LITERAL_REPRESENTATION` | `DECIMAL_LITERAL_REPRESENTATIONS` | Should use plural form (guideline 3) - 'representation' is a countable noun | +| `DECLARE_INTERIOR_MUTABLE_CONST` | `DECLARE_INTERIOR_MUTABLE_CONSTS` | Should use plural form (guideline 3) - 'const' is a countable noun | +| `DEFAULT_NUMERIC_FALLBACK` | `DEFAULT_NUMERIC_FALLBACKS` | Should use plural form (guideline 3) - 'fallback' is a countable noun | +| `DEFAULT_UNION_REPRESENTATION` | `DEFAULT_UNION_REPRESENTATIONS` | Should use plural form (guideline 3) - 'representation' is a countable noun | +| `DEPRECATED_SEMVER` | `DEPRECATED_SEMVERS` | Should use plural form (guideline 3) - 'semver' is a countable noun | +| `DIVERGING_SUB_EXPRESSION` | `DIVERGING_SUB_EXPRESSIONS` | Should use plural form (guideline 3) - 'expression' is a countable noun | +| `DOC_BROKEN_LINK` | `DOC_BROKEN_LINKS` | Should use plural form (guideline 3) - 'link' is a countable noun | +| `DOC_LAZY_CONTINUATION` | `DOC_LAZY_CONTINUATIONS` | Should use plural form (guideline 3) - 'continuation' is a countable noun | +| `DOC_OVERINDENTED_LIST_ITEMS` | `DOC_OVERINDENTED_LISTS` | Has redundant '_items' suffix (guideline 2); plural form | +| `DOC_PARAGRAPHS_MISSING_PUNCTUATION` | `DOC_PARAGRAPHS_MISSING_PUNCTUATIONS` | Should use plural form (guideline 3) - 'punctuation' is a countable noun | +| `DUPLICATE_MOD` | `DUPLICATE_MODS` | Should use plural form (guideline 3) - 'mod' is a countable noun | +| `DUPLICATE_UNDERSCORE_ARGUMENT` | `DUPLICATE_UNDERSCORE_ARGUMENTS` | Should use plural form (guideline 3) - 'argument' is a countable noun | +| `EAGER_TRANSMUTE` | `EAGER_TRANSMUTES` | Should use plural form (guideline 3) - 'transmute' is a countable noun | +| `EMPTY_LOOP` | `EMPTY_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `ENUM_CLIKE_UNPORTABLE_VARIANT` | `ENUM_CLIKE_UNPORTABLE_VARIANTS` | Should use plural form (guideline 3) - 'variant' is a countable noun | +| `ERROR_IMPL_ERROR` | `ERROR_IMPL_ERRORS` | Should use plural form (guideline 3) - 'error' is a countable noun | +| `EXCESSIVE_NESTING` | `EXCESSIVE_NESTINGS` | Should use plural form (guideline 3) - 'nesting' is a countable noun | +| `EXCESSIVE_PRECISION` | `EXCESSIVE_PRECISIONS` | Should use plural form (guideline 3) - 'precision' is a countable noun | +| `EXPECT_FUN_CALL` | `EXPECT_FUN_CALLS` | Should use plural form (guideline 3) - 'call' is a countable noun | +| `EXPLICIT_COUNTER_LOOP` | `EXPLICIT_COUNTER_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `EXPLICIT_INTO_ITER_LOOP` | `EXPLICIT_INTO_ITER_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `EXPLICIT_ITER_LOOP` | `EXPLICIT_ITER_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `FLAT_MAP_OPTION` | `FLAT_MAP_OPTIONS` | Should use plural form (guideline 3) - 'option' is a countable noun | +| `FLOAT_CMP_CONST` | `FLOAT_CMP_CONSTS` | Should use plural form (guideline 3) - 'const' is a countable noun | +| `FN_TO_NUMERIC_CAST` | `FN_TO_NUMERIC_CASTS` | Should use plural form (guideline 3) - 'cast' is a countable noun | +| `FN_TO_NUMERIC_CAST_WITH_TRUNCATION` | `FN_TO_NUMERIC_CAST_WITH_TRUNCATIONS` | Should use plural form (guideline 3) - 'truncation' is a countable noun | +| `FORMAT_PUSH_STRING` | `FORMAT_PUSH_STRINGS` | Should use plural form (guideline 3) - 'string' is a countable noun | +| `FROM_RAW_WITH_VOID_PTR` | `FROM_RAW_WITH_VOID_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `IMPLICIT_HASHER` | `IMPLICIT_HASHERS` | Should use plural form (guideline 3) - 'hasher' is a countable noun | +| `INCONSISTENT_STRUCT_CONSTRUCTOR` | `INCONSISTENT_STRUCT_CONSTRUCTORS` | Should use plural form (guideline 3) - 'constructor' is a countable noun | +| `INDEX_REFUTABLE_SLICE` | `INDEX_REFUTABLE_SLICES` | Should use plural form (guideline 3) - 'slice' is a countable noun | +| `INEFFECTIVE_BIT_MASK` | `INEFFECTIVE_BIT_MASKS` | Should use plural form (guideline 3) - 'mask' is a countable noun | +| `INEFFICIENT_TO_STRING` | `INEFFICIENT_TO_STRINGS` | Should use plural form (guideline 3) - 'string' is a countable noun | +| `INFALLIBLE_DESTRUCTURING_MATCH` | `INFALLIBLE_DESTRUCTURING_MATCHES` | Should use plural form (guideline 3) - 'match' is a countable noun | +| `INFINITE_ITER` | `INFINITE_ITERS` | Should use plural form (guideline 3) - 'iter' is a countable noun | +| `INFINITE_LOOP` | `INFINITE_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `INHERENT_TO_STRING` | `INHERENT_TO_STRINGS` | Should use plural form (guideline 3) - 'string' is a countable noun | +| `INTEGER_DIVISION` | `INTEGER_DIVISIONS` | Should use plural form (guideline 3) - 'division' is a countable noun | +| `INTO_ITER_ON_REF` | `INTO_ITER_ON_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `INTO_ITER_WITHOUT_ITER` | `INTO_ITER_WITHOUT_ITERS` | Should use plural form (guideline 3) - 'iter' is a countable noun | +| `IO_OTHER_ERROR` | `IO_OTHER_ERRORS` | Should use plural form (guideline 3) - 'error' is a countable noun | +| `IP_CONSTANT` | `IP_CONSTANTS` | Should use plural form (guideline 3) - 'constant' is a countable noun | +| `ITEMS_AFTER_TEST_MODULE` | `ITEMS_AFTER_TEST_MODULES` | Should use plural form (guideline 3) - 'module' is a countable noun | +| `ITER_FILTER_IS_OK` | `ITER_FILTERS_IS_OK` | Should use plural form (guideline 3) - 'filter' is a countable noun | +| `ITER_NEXT_LOOP` | `ITER_NEXT_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `ITER_NEXT_SLICE` | `ITER_NEXT_SLICES` | Should use plural form (guideline 3) - 'slice' is a countable noun | +| `ITER_NOT_RETURNING_ITERATOR` | `ITER_NOT_RETURNING_ITERATORS` | Should use plural form (guideline 3) - 'iterator' is a countable noun | +| `ITER_OVER_HASH_TYPE` | `ITER_OVER_HASH_TYPES` | Should use plural form (guideline 3) - 'type' is a countable noun | +| `ITER_WITHOUT_INTO_ITER` | `ITER_WITHOUT_INTO_ITERS` | Should use plural form (guideline 3) - 'iter' is a countable noun | +| `LARGE_ENUM_VARIANT` | `LARGE_ENUM_VARIANTS` | Should use plural form (guideline 3) - 'variant' is a countable noun | +| `LET_UNDERSCORE_LOCK` | `LET_UNDERSCORE_LOCKS` | Should use plural form (guideline 3) - 'lock' is a countable noun | +| `LOSSY_FLOAT_LITERAL` | `LOSSY_FLOAT_LITERALS` | Should use plural form (guideline 3) - 'literal' is a countable noun | +| `MANUAL_DANGLING_PTR` | `MANUAL_DANGLING_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `MANUAL_FILTER` | `MANUAL_FILTERS` | Should use plural form (guideline 3) - 'filter' is a countable noun | +| `MANUAL_OPTION_AS_SLICE` | `MANUAL_OPTION_AS_SLICES` | Should use plural form (guideline 3) - 'slice' is a countable noun | +| `MANUAL_SLICE_SIZE_CALCULATION` | `MANUAL_SLICE_SIZE_CALCULATIONS` | Should use plural form (guideline 3) - 'calculation' is a countable noun | +| `MATCH_AS_REF` | `MATCH_AS_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `MAYBE_INFINITE_ITER` | `MAYBE_INFINITE_ITERS` | Should use plural form (guideline 3) - 'iter' is a countable noun | +| `MISMATCHING_TYPE_PARAM_ORDER` | `MISMATCHING_TYPE_PARAM_ORDERS` | Should use plural form (guideline 3) - 'order' is a countable noun | +| `MISSING_CONST_FOR_FN` | `MISSING_CONSTS_FOR_FN` | Should use plural form (guideline 3) - 'const' is a countable noun | +| `MISSING_CONST_FOR_THREAD_LOCAL` | `MISSING_CONST_FOR_THREAD_LOCALS` | Should use plural form (guideline 3) - 'local' is a countable noun | +| `MISSING_SPIN_LOOP` | `MISSING_SPIN_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `MIXED_READ_WRITE_IN_EXPRESSION` | `MIXED_READ_WRITE_IN_EXPRESSIONS` | Should use plural form (guideline 3) - 'expression' is a countable noun | +| `MODULE_INCEPTION` | `MODULE_INCEPTIONS` | Should use plural form (guideline 3) - 'inception' is a countable noun | +| `MUTABLE_KEY_TYPE` | `MUTABLE_KEY_TYPES` | Should use plural form (guideline 3) - 'type' is a countable noun | +| `MUTEX_INTEGER` | `MUTEX_INTEGERS` | Should use plural form (guideline 3) - 'integer' is a countable noun | +| `MUT_FROM_REF` | `MUT_FROM_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `MUT_MUTEX_LOCK` | `MUT_MUTEX_LOCKS` | Should use plural form (guideline 3) - 'lock' is a countable noun | +| `NEEDLESS_ARBITRARY_SELF_TYPE` | `UNNECESSARY_ARBITRARY_SELF_TYPES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple type usages) | +| `NEEDLESS_AS_BYTES` | `UNNECESSARY_AS_BYTES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple conversions) | +| `NEEDLESS_BITWISE_BOOL` | `UNNECESSARY_BITWISE_BOOLS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple expressions) | +| `NEEDLESS_BOOL` | `UNNECESSARY_BOOLS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple if-statements) | +| `NEEDLESS_BOOL_ASSIGN` | `UNNECESSARY_BOOL_ASSIGNS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple assignments) | +| `NEEDLESS_BORROW` | `UNNECESSARY_BORROWS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple borrows) | +| `NEEDLESS_BORROWED_REFERENCE` | `UNNECESSARY_BORROWED_REFERENCES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple references) | | `NEEDLESS_BORROWS_FOR_GENERIC_ARGS` | `UNNECESSARY_BORROWS_FOR_GENERIC_ARGS` | Uses 'needless' instead of 'unnecessary' (already plural) | -| `NEEDLESS_CHARACTER_ITERATION` | `UNNECESSARY_CHARACTER_ITERATIONS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple iterations) | -| `NEEDLESS_COLLECT` | `UNNECESSARY_COLLECTS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple collect calls) | -| `NEEDLESS_CONTINUE` | `UNNECESSARY_CONTINUES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple continue statements) | -| `NEEDLESS_DOCTEST_MAIN` | `UNNECESSARY_DOCTEST_MAINS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple doctests) | -| `NEEDLESS_ELSE` | `UNNECESSARY_ELSES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple else blocks) | -| `NEEDLESS_FOR_EACH` | `UNNECESSARY_FOR_EACHES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple for_each calls) | +| `NEEDLESS_CHARACTER_ITERATION` | `UNNECESSARY_CHARACTER_ITERATIONS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple iterations) | +| `NEEDLESS_COLLECT` | `UNNECESSARY_COLLECTS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple calls) | +| `NEEDLESS_CONTINUE` | `UNNECESSARY_CONTINUES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple statements) | +| `NEEDLESS_DOCTEST_MAIN` | `UNNECESSARY_DOCTEST_MAINS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple doctests) | +| `NEEDLESS_ELSE` | `UNNECESSARY_ELSES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple blocks) | +| `NEEDLESS_FOR_EACH` | `UNNECESSARY_FOR_EACHES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple calls) | | `NEEDLESS_IFS` | `UNNECESSARY_IFS` | Uses 'needless' instead of 'unnecessary' (already plural) | -| `NEEDLESS_LATE_INIT` | `UNNECESSARY_LATE_INITS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple initializations) | +| `NEEDLESS_LATE_INIT` | `UNNECESSARY_LATE_INITS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple initializations) | | `NEEDLESS_LIFETIMES` | `UNNECESSARY_LIFETIMES` | Uses 'needless' instead of 'unnecessary' (already plural) | -| `NEEDLESS_MATCH` | `UNNECESSARY_MATCHES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple match expressions) | -| `NEEDLESS_MAYBE_SIZED` | `UNNECESSARY_MAYBE_SIZEDS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple bounds) | -| `NEEDLESS_OPTION_AS_DEREF` | `UNNECESSARY_OPTION_AS_DEREFS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple method calls) | -| `NEEDLESS_OPTION_TAKE` | `UNNECESSARY_OPTION_TAKES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple take calls) | +| `NEEDLESS_MATCH` | `UNNECESSARY_MATCHES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple expressions) | +| `NEEDLESS_MAYBE_SIZED` | `UNNECESSARY_MAYBE_SIZEDS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple bounds) | +| `NEEDLESS_OPTION_AS_DEREF` | `UNNECESSARY_OPTION_AS_DEREFS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple calls) | +| `NEEDLESS_OPTION_TAKE` | `UNNECESSARY_OPTION_TAKES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple calls) | | `NEEDLESS_PARENS_ON_RANGE_LITERALS` | `UNNECESSARY_PARENS_ON_RANGE_LITERALS` | Uses 'needless' instead of 'unnecessary' (already plural) | -| `NEEDLESS_PASS_BY_REF_MUT` | `UNNECESSARY_PASS_BY_REF_MUTS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple parameters) | -| `NEEDLESS_PASS_BY_VALUE` | `UNNECESSARY_PASS_BY_VALUES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple parameters) | -| `NEEDLESS_PUB_SELF` | `UNNECESSARY_PUB_SELFS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple visibility modifiers) | -| `NEEDLESS_QUESTION_MARK` | `UNNECESSARY_QUESTION_MARKS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple uses) | -| `NEEDLESS_RANGE_LOOP` | `UNNECESSARY_RANGE_LOOPS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple loops) | +| `NEEDLESS_PASS_BY_REF_MUT` | `UNNECESSARY_PASS_BY_REF_MUTS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple parameters) | +| `NEEDLESS_PASS_BY_VALUE` | `UNNECESSARY_PASS_BY_VALUES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple parameters) | +| `NEEDLESS_PUB_SELF` | `UNNECESSARY_PUB_SELFS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple modifiers) | +| `NEEDLESS_QUESTION_MARK` | `UNNECESSARY_QUESTION_MARKS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple uses) | +| `NEEDLESS_RANGE_LOOP` | `UNNECESSARY_RANGE_LOOPS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple loops) | | `NEEDLESS_RAW_STRINGS` | `UNNECESSARY_RAW_STRINGS` | Uses 'needless' instead of 'unnecessary' (already plural) | | `NEEDLESS_RAW_STRING_HASHES` | `UNNECESSARY_RAW_STRING_HASHES` | Uses 'needless' instead of 'unnecessary' (already plural) | -| `NEEDLESS_RETURN` | `UNNECESSARY_RETURNS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple return statements) | -| `NEEDLESS_RETURN_WITH_QUESTION_MARK` | `UNNECESSARY_RETURNS_WITH_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple returns) | -| `NEEDLESS_SPLITN` | `UNNECESSARY_SPLITNS` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple splitn calls) | -| `NEEDLESS_UPDATE` | `UNNECESSARY_UPDATES` | Uses 'needless' instead of 'unnecessary'; should use plural (checks multiple struct updates) | -| `NONMINIMAL_BOOL` | `NONMINIMAL_BOOLS` | Should use plural form (guideline 3) - checks multiple boolean expressions | -| `USED_UNDERSCORE_ITEMS` | `USED_UNDERSCORES` | Has redundant suffix '_items' (guideline 2); should use plural | -| `USELESS_ASREF` | `UNUSED_ASREFS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple as_ref calls) | -| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTES` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple attributes) | -| `USELESS_CONCAT` | `UNUSED_CONCATS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple concat calls) | -| `USELESS_CONVERSION` | `UNUSED_CONVERSIONS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple conversion calls) | -| `USELESS_FORMAT` | `UNUSED_FORMATS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple format calls) | -| `USELESS_LET_IF_SEQ` | `UNUSED_LET_IF_SEQS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple patterns) | -| `USELESS_NONZERO_NEW_UNCHECKED` | `UNUSED_NONZERO_NEW_UNCHECKEDS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple calls) | -| `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTES` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple transmute calls) | -| `USELESS_VEC` | `UNUSED_VECS` | Uses 'useless' instead of 'unused' (guideline 4); should use plural (checks multiple vec constructions) | +| `NEEDLESS_RETURN` | `UNNECESSARY_RETURNS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple statements) | +| `NEEDLESS_RETURN_WITH_QUESTION_MARK` | `UNNECESSARY_RETURNS_WITH_QUESTION_MARK` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple returns) | +| `NEEDLESS_SPLITN` | `UNNECESSARY_SPLITNS` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple calls) | +| `NEEDLESS_UPDATE` | `UNNECESSARY_UPDATES` | Uses 'needless' instead of 'unnecessary'; plural form (checks multiple updates) | +| `NEVER_LOOP` | `NEVER_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `NONMINIMAL_BOOL` | `NONMINIMAL_BOOLS` | Should use plural form (guideline 3) - checks multiple expressions | +| `NON_ASCII_LITERAL` | `NON_ASCII_LITERALS` | Should use plural form (guideline 3) - 'literal' is a countable noun | +| `OPTION_OPTION` | `OPTION_OPTIONS` | Should use plural form (guideline 3) - 'option' is a countable noun | +| `OP_REF` | `OP_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `OR_FUN_CALL` | `OR_FUN_CALLS` | Should use plural form (guideline 3) - 'call' is a countable noun | +| `PRINTLN_EMPTY_STRING` | `PRINTLN_EMPTY_STRINGS` | Should use plural form (guideline 3) - 'string' is a countable noun | +| `PRINT_LITERAL` | `PRINT_LITERALS` | Should use plural form (guideline 3) - 'literal' is a countable noun | +| `PTR_AS_PTR` | `PTR_AS_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `PTR_CAST_CONSTNESS` | `PTR_CAST_CONSTNESSES` | Should use plural form (guideline 3) - 'constness' is a countable noun | +| `PTR_EQ` | `PTRS_EQ` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `PTR_OFFSET_WITH_CAST` | `PTR_OFFSET_WITH_CASTS` | Should use plural form (guideline 3) - 'cast' is a countable noun | +| `RC_BUFFER` | `RC_BUFFERS` | Should use plural form (guideline 3) - 'buffer' is a countable noun | +| `READONLY_WRITE_LOCK` | `READONLY_WRITE_LOCKS` | Should use plural form (guideline 3) - 'lock' is a countable noun | +| `READ_ZERO_BYTE_VEC` | `READ_ZERO_BYTE_VECS` | Should use plural form (guideline 3) - 'vec' is a countable noun | +| `REDUNDANT_ALLOCATION` | `REDUNDANT_ALLOCATIONS` | Should use plural form (guideline 3) - 'allocation' is a countable noun | +| `REDUNDANT_CLOSURE_CALL` | `REDUNDANT_CLOSURE_CALLS` | Should use plural form (guideline 3) - 'call' is a countable noun | +| `REDUNDANT_PUB_CRATE` | `REDUNDANT_PUB_CRATES` | Should use plural form (guideline 3) - 'crate' is a countable noun | +| `REF_AS_PTR` | `REF_AS_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `REF_OPTION` | `REF_OPTIONS` | Should use plural form (guideline 3) - 'option' is a countable noun | +| `REF_OPTION_REF` | `REF_OPTION_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `REPLACE_BOX` | `REPLACE_BOXES` | Should use plural form (guideline 3) - 'box' is a countable noun | +| `RESERVE_AFTER_INITIALIZATION` | `RESERVE_AFTER_INITIALIZATIONS` | Should use plural form (guideline 3) - 'initialization' is a countable noun | +| `RESULT_MAP_OR_INTO_OPTION` | `RESULT_MAP_OR_INTO_OPTIONS` | Should use plural form (guideline 3) - 'option' is a countable noun | +| `SAME_FUNCTIONS_IN_IF_CONDITION` | `SAME_FUNCTIONS_IN_IF_CONDITIONS` | Should use plural form (guideline 3) - 'condition' is a countable noun | +| `SAME_NAME_METHOD` | `SAME_NAME_METHODS` | Should use plural form (guideline 3) - 'method' is a countable noun | +| `SELF_ASSIGNMENT` | `SELF_ASSIGNMENTS` | Should use plural form (guideline 3) - 'assignment' is a countable noun | +| `SHORT_CIRCUIT_STATEMENT` | `SHORT_CIRCUIT_STATEMENTS` | Should use plural form (guideline 3) - 'statement' is a countable noun | +| `SINGLE_CALL_FN` | `SINGLE_CALLS_FN` | Should use plural form (guideline 3) - 'call' is a countable noun | +| `SINGLE_ELEMENT_LOOP` | `SINGLE_ELEMENT_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `SINGLE_MATCH` | `SINGLE_MATCHES` | Should use plural form (guideline 3) - 'match' is a countable noun | +| `SIZE_OF_REF` | `SIZE_OF_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `SLOW_VECTOR_INITIALIZATION` | `SLOW_VECTOR_INITIALIZATIONS` | Should use plural form (guideline 3) - 'initialization' is a countable noun | +| `STRING_SLICE` | `STRING_SLICES` | Should use plural form (guideline 3) - 'slice' is a countable noun | +| `STR_TO_STRING` | `STR_TO_STRINGS` | Should use plural form (guideline 3) - 'string' is a countable noun | +| `SWAP_PTR_TO_REF` | `SWAP_PTR_TO_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `TEMPORARY_ASSIGNMENT` | `TEMPORARY_ASSIGNMENTS` | Should use plural form (guideline 3) - 'assignment' is a countable noun | +| `TESTS_OUTSIDE_TEST_MODULE` | `TESTS_OUTSIDE_TEST_MODULES` | Should use plural form (guideline 3) - 'module' is a countable noun | +| `TRANSMUTE_PTR_TO_PTR` | `TRANSMUTE_PTR_TO_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | +| `TRANSMUTE_PTR_TO_REF` | `TRANSMUTE_PTR_TO_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `TRIVIALLY_COPY_PASS_BY_REF` | `TRIVIALLY_COPY_PASS_BY_REFS` | Should use plural form (guideline 3) - 'ref' is a countable noun | +| `TYPE_ID_ON_BOX` | `TYPE_ID_ON_BOXES` | Should use plural form (guideline 3) - 'box' is a countable noun | +| `UNCHECKED_TIME_SUBTRACTION` | `UNCHECKED_TIME_SUBTRACTIONS` | Should use plural form (guideline 3) - 'subtraction' is a countable noun | +| `UNINIT_VEC` | `UNINIT_VECS` | Should use plural form (guideline 3) - 'vec' is a countable noun | +| `UNNECESSARY_CAST` | `UNNECESSARY_CASTS` | Should use plural form (guideline 3) - 'cast' is a countable noun | +| `UNNECESSARY_MAP_ON_CONSTRUCTOR` | `UNNECESSARY_MAP_ON_CONSTRUCTORS` | Should use plural form (guideline 3) - 'constructor' is a countable noun | +| `UNNECESSARY_OPERATION` | `UNNECESSARY_OPERATIONS` | Should use plural form (guideline 3) - 'operation' is a countable noun | +| `UNNECESSARY_SAFETY_COMMENT` | `UNNECESSARY_SAFETY_COMMENTS` | Should use plural form (guideline 3) - 'comment' is a countable noun | +| `UNNECESSARY_STRUCT_INITIALIZATION` | `UNNECESSARY_STRUCT_INITIALIZATIONS` | Should use plural form (guideline 3) - 'initialization' is a countable noun | +| `UNREADABLE_LITERAL` | `UNREADABLE_LITERALS` | Should use plural form (guideline 3) - 'literal' is a countable noun | +| `UNSOUND_COLLECTION_TRANSMUTE` | `UNSOUND_COLLECTION_TRANSMUTES` | Should use plural form (guideline 3) - 'transmute' is a countable noun | +| `USED_UNDERSCORE_ITEMS` | `USED_UNDERSCORES` | Has redundant '_items' suffix (guideline 2); plural form | +| `USELESS_ASREF` | `UNUSED_ASREFS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple calls) | +| `USELESS_ATTRIBUTE` | `UNUSED_ATTRIBUTES` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple attributes) | +| `USELESS_CONCAT` | `UNUSED_CONCATS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple calls) | +| `USELESS_CONVERSION` | `UNUSED_CONVERSIONS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple calls) | +| `USELESS_FORMAT` | `UNUSED_FORMATS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple calls) | +| `USELESS_LET_IF_SEQ` | `UNUSED_LET_IF_SEQS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple patterns) | +| `USELESS_NONZERO_NEW_UNCHECKED` | `UNUSED_NONZERO_NEW_UNCHECKEDS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple calls) | +| `USELESS_TRANSMUTE` | `UNUSED_TRANSMUTES` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple calls) | +| `USELESS_VEC` | `UNUSED_VECS` | Uses 'useless' instead of 'unused' (guideline 4); plural form (checks multiple constructions) | +| `VEC_BOX` | `VEC_BOXES` | Should use plural form (guideline 3) - 'box' is a countable noun | +| `VERBOSE_BIT_MASK` | `VERBOSE_BIT_MASKS` | Should use plural form (guideline 3) - 'mask' is a countable noun | +| `WHILE_IMMUTABLE_CONDITION` | `WHILE_IMMUTABLE_CONDITIONS` | Should use plural form (guideline 3) - 'condition' is a countable noun | +| `WHILE_LET_LOOP` | `WHILE_LET_LOOPS` | Should use plural form (guideline 3) - 'loop' is a countable noun | +| `WHILE_LET_ON_ITERATOR` | `WHILE_LET_ON_ITERATORS` | Should use plural form (guideline 3) - 'iterator' is a countable noun | +| `WRITELN_EMPTY_STRING` | `WRITELN_EMPTY_STRINGS` | Should use plural form (guideline 3) - 'string' is a countable noun | +| `WRITE_LITERAL` | `WRITE_LITERALS` | Should use plural form (guideline 3) - 'literal' is a countable noun | +| `WRONG_TRANSMUTE` | `WRONG_TRANSMUTES` | Should use plural form (guideline 3) - 'transmute' is a countable noun | +| `ZERO_PREFIXED_LITERAL` | `ZERO_PREFIXED_LITERALS` | Should use plural form (guideline 3) - 'literal' is a countable noun | +| `ZERO_PTR` | `ZERO_PTRS` | Should use plural form (guideline 3) - 'ptr' is a countable noun | ## Lints Kept Singular (Examples) @@ -95,11 +252,11 @@ The following categories of lints are appropriately kept singular: - `PRINT_LITERAL` - refers to printing pattern ### Traits -- `DEFAULT_TRAIT_ACCESS` - refers to the `Default` trait +- `DEFAULT_TRAIT_ACCESS` - refers to the `Default` trait concept - `FUTURE_NOT_SEND` - refers to the `Send` trait bound ### Patterns and Concepts -- `BOOL_COMPARISON` - refers to the comparison pattern +- `ASSIGN_OP_PATTERN` - refers to the assignment operator pattern - `MODULE_STYLE` - refers to module organization style - `ARBITRARY_SOURCE_ITEM_ORDERING` - refers to ordering concept - `COGNITIVE_COMPLEXITY` - refers to complexity metric @@ -110,12 +267,12 @@ The following lints may have names that don't clearly state the bad thing being | Current Name | What it checks | Issue | Suggested Alternative | |--------------|----------------|-------|----------------------| -| `ALLOW_ATTRIBUTES` | Usage of `#[allow]` instead of `#[expect]` | Name suggests allowing is bad, but the bad thing is missing expectations | Consider `MISSING_EXPECT_ATTRIBUTES` or `PREFER_EXPECT_OVER_ALLOW` | -| `ALLOW_ATTRIBUTES_WITHOUT_REASON` | `#[allow]` attributes without a reason parameter | Name is confusing with nested "allow" | Consider `MISSING_ALLOW_REASONS` or `UNDOCUMENTED_ALLOWS` | -| `USE_DEBUG` | Usage of Debug formatting in user-facing output | Name suggests positive action, bad thing is inappropriate Debug formatting | Consider `DEBUG_IN_USER_OUTPUTS` or `INAPPROPRIATE_DEBUG_FMTS` | -| `USE_SELF` | Unnecessary repetition of struct name instead of `Self` | Name suggests positive action, bad thing is unnecessary type repetition | Consider `UNNECESSARY_STRUCT_NAMES` or `MISSING_SELF_USAGES` | +| `ALLOW_ATTRIBUTES` | Usage of `#[allow]` instead of `#[expect]` | Name suggests allowing is bad | Consider `MISSING_EXPECT_ATTRIBUTES` | +| `ALLOW_ATTRIBUTES_WITHOUT_REASON` | `#[allow]` attributes without a reason parameter | Confusing nested "allow" | Consider `MISSING_ALLOW_REASONS` | +| `USE_DEBUG` | Usage of Debug formatting in user-facing output | Name suggests positive action | Consider `DEBUG_IN_USER_OUTPUTS` | +| `USE_SELF` | Unnecessary repetition of struct name instead of `Self` | Name suggests positive action | Consider `UNNECESSARY_STRUCT_NAMES` | -**Note**: These suggestions use plural forms consistent with the pluralization philosophy. +**Note**: These suggestions use plural forms where appropriate. ## Rationale @@ -128,14 +285,14 @@ The RFC 0344 guidelines don't mention "needless" as a standard term. The term "u Per guideline 4, lints that catch "unnecessary, unused, or useless aspects of code should use the term `unused`". -### Why aggressive pluralization +### Why comprehensive noun-based pluralization -Per guideline 3, when a lint checks multiple instances of a specific grammatical class, it should use the plural form. Since most lints can find multiple occurrences in code, plural forms are more accurate. For example: -- `UNNECESSARY_BORROWS` - a codebase can have many unnecessary borrows -- `UNNECESSARY_RETURNS` - a function can have multiple unnecessary return statements -- `UNUSED_CONVERSIONS` - code can contain multiple unused conversion calls +Per guideline 3, when a lint applies to a specific grammatical class (countable nouns), it should use the plural form. This makes lint names more accurate: +- `UNNECESSARY_BORROWS` - can find many unnecessary borrows +- `AWAIT_HOLDING_LOCKS` - can detect multiple lock-holding issues +- `CAST_PTR_ALIGNMENTS` - checks multiple pointer cast alignments -This makes `#[allow(unnecessary_borrows)]` read as "allow (multiple) unnecessary borrows" which is more accurate than the singular form. +This makes `#[allow(unnecessary_borrows)]` read correctly as "allow (multiple) unnecessary borrows". ## Examples @@ -144,23 +301,17 @@ Before: #[allow(needless_borrow)] // Singular let x = &value; -#[allow(needless_return)] // Singular -fn foo() -> i32 { return 42; } - -#[allow(useless_conversion)] // Singular -let x: i32 = value.into(); +#[allow(await_holding_lock)] // Singular +let guard = mutex.lock().await; ``` After: ```rust -#[allow(unnecessary_borrows)] // Plural - can have multiple +#[allow(unnecessary_borrows)] // Plural let x = &value; -#[allow(unnecessary_returns)] // Plural - can have multiple -fn foo() -> i32 { return 42; } - -#[allow(unused_conversions)] // Plural - can have multiple -let x: i32 = value.into(); +#[allow(await_holding_locks)] // Plural +let guard = mutex.lock().await; ``` ## Implementation Notes