Compare two identifiers ignoring case and treating snake_case as equivalent to camelCase. For example, `eq_ignore_case_snake("myParam", "my_param")` returns true.
(a: &str, b: &str)
| 512 | /// |
| 513 | /// For example, `eq_ignore_case_snake("myParam", "my_param")` returns true. |
| 514 | fn eq_ignore_case_snake(a: &str, b: &str) -> bool { |
| 515 | if a.eq_ignore_ascii_case(b) { |
| 516 | return true; |
| 517 | } |
| 518 | // Normalize both to lowercase without underscores and compare. |
| 519 | let norm_a: String = a |
| 520 | .chars() |
| 521 | .filter(|c| *c != '_') |
| 522 | .flat_map(|c| c.to_lowercase()) |
| 523 | .collect(); |
| 524 | let norm_b: String = b |
| 525 | .chars() |
| 526 | .filter(|c| *c != '_') |
| 527 | .flat_map(|c| c.to_lowercase()) |
| 528 | .collect(); |
| 529 | norm_a == norm_b |
| 530 | } |
| 531 | |
| 532 | /// Check whether a single-parameter call has an obvious relationship |
| 533 | /// between the function/method name and the parameter, making the hint |
no test coverage detected