Skip to content

fix manual_ignore_case_cmp chars iterator cmp#16962

Open
cyphercodes wants to merge 1 commit intorust-lang:masterfrom
cyphercodes:fix/manual-ignore-case-cmp-chars
Open

fix manual_ignore_case_cmp chars iterator cmp#16962
cyphercodes wants to merge 1 commit intorust-lang:masterfrom
cyphercodes:fix/manual-ignore-case-cmp-chars

Conversation

@cyphercodes
Copy link
Copy Markdown

@cyphercodes cyphercodes commented May 4, 2026

changelog: [manual_ignore_case_cmp]: detect case-folded .chars() iterators compared with Iterator::cmp

Fixes #16961

Summary

  • Detect .chars().map(|c| c.to_ascii_lowercase()/to_ascii_uppercase()).cmp(...).is_eq() forms.
  • Also handle the corresponding .is_ne() form by suggesting !eq_ignore_ascii_case.
  • Add UI coverage for borrowed strings, owned strings, and the to_str().is_some_and(...) closure reproducer.

Tests

  • cargo fmt --check -- clippy_lints/src/manual_ignore_case_cmp.rs tests/ui/manual_ignore_case_cmp.rs clippy_utils/src/sym.rs
  • TESTNAME=manual_ignore_case_cmp cargo uibless
  • TESTNAME=manual_ignore_case_cmp cargo uitest
  • cargo test --test dogfood
  • git diff --check

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 4, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 4, 2026

r? @samueltardieu

rustbot has assigned @samueltardieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@cyphercodes cyphercodes force-pushed the fix/manual-ignore-case-cmp-chars branch from 6155d22 to f58a16a Compare May 4, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manual_ignore_case_cmp: Please detect forms using .chars() and Iterator::cmp as well

3 participants