@@ -29,6 +29,7 @@ use std::{cmp, os, path};
2929use std:: io:: fs:: { mod, PathExtensions } ;
3030use std:: path:: is_sep;
3131use std:: string:: String ;
32+ use std:: ascii:: AsciiExt ;
3233
3334use PatternToken :: { Char , AnyChar , AnySequence , AnyRecursiveSequence , AnyWithin , AnyExcept } ;
3435use CharSpecifier :: { SingleChar , CharRange } ;
@@ -547,18 +548,16 @@ fn in_char_specifiers(specifiers: &[CharSpecifier], c: char, options: &MatchOpti
547548 // FIXME: work with non-ascii chars properly (issue #1347)
548549 if !options. case_sensitive && c. is_ascii ( ) && start. is_ascii ( ) && end. is_ascii ( ) {
549550
550- let start = start. to_ascii ( ) . to_lowercase ( ) ;
551- let end = end. to_ascii ( ) . to_lowercase ( ) ;
551+ let start = start. to_ascii_lowercase ( ) ;
552+ let end = end. to_ascii_lowercase ( ) ;
552553
553554 let start_up = start. to_uppercase ( ) ;
554555 let end_up = end. to_uppercase ( ) ;
555556
556557 // only allow case insensitive matching when
557558 // both start and end are within a-z or A-Z
558559 if start != start_up && end != end_up {
559- let start = start. as_char ( ) ;
560- let end = end. as_char ( ) ;
561- let c = c. to_ascii ( ) . to_lowercase ( ) . as_char ( ) ;
560+ let c = c. to_ascii_lowercase ( ) ;
562561 if c >= start && c <= end {
563562 return true ;
564563 }
@@ -581,7 +580,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {
581580 true
582581 } else if !case_sensitive && a. is_ascii ( ) && b. is_ascii ( ) {
583582 // FIXME: work with non-ascii chars properly (issue #9084)
584- a. to_ascii ( ) . to_lowercase ( ) == b. to_ascii ( ) . to_lowercase ( )
583+ a. to_ascii_lowercase ( ) == b. to_ascii_lowercase ( )
585584 } else {
586585 a == b
587586 }
0 commit comments