Skip to content

Commit 4506df0

Browse files
committed
Merge pull request #17 from akiss77/pr-ascii-reform
Keep up with std::ascii reform.
2 parents 3c18564 + 67d3f28 commit 4506df0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/lib.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2525
html_root_url = "http://doc.rust-lang.org/glob/")]
2626

27+
use std::ascii::AsciiExt;
2728
use std::cell::Cell;
2829
use std::{cmp, os, path};
2930
use std::io::fs::{mod, PathExtensions};
@@ -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

Comments
 (0)