mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #145152 - xizheyin:detect-confusion-type, r=lqd
Use `eq_ignore_ascii_case` to avoid heap alloc in `detect_confuse_type` A small optimization has been made, using `to_ascii_lowercase()` instead of `to_lowercase().to_string()`. r? compiler
This commit is contained in:
@@ -3546,7 +3546,7 @@ pub fn detect_confusion_type(sm: &SourceMap, suggested: &str, sp: Span) -> Confu
|
||||
|
||||
for (f, s) in iter::zip(found.chars(), suggested.chars()) {
|
||||
if f != s {
|
||||
if f.to_lowercase().to_string() == s.to_lowercase().to_string() {
|
||||
if f.eq_ignore_ascii_case(&s) {
|
||||
// Check for case differences (any character that differs only in case)
|
||||
if ascii_confusables.contains(&f) || ascii_confusables.contains(&s) {
|
||||
has_case_diff = true;
|
||||
|
||||
Reference in New Issue
Block a user