Skip to content

Commit cf1a1b7

Browse files
committed
Use eq_ignore_ascii_case to avoid heap alloc in detect_confuse_type
Signed-off-by: xizheyin <[email protected]>
1 parent a980cd4 commit cf1a1b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,7 @@ pub fn detect_confusion_type(sm: &SourceMap, suggested: &str, sp: Span) -> Confu
35463546

35473547
for (f, s) in iter::zip(found.chars(), suggested.chars()) {
35483548
if f != s {
3549-
if f.to_lowercase().to_string() == s.to_lowercase().to_string() {
3549+
if f.eq_ignore_ascii_case(&s) {
35503550
// Check for case differences (any character that differs only in case)
35513551
if ascii_confusables.contains(&f) || ascii_confusables.contains(&s) {
35523552
has_case_diff = true;

0 commit comments

Comments
 (0)