Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/glob/")]

use std::ascii::AsciiExt;
use std::cell::Cell;
use std::{cmp, os, path};
use std::io::fs::{mod, PathExtensions};
Expand Down Expand Up @@ -547,18 +548,16 @@ fn in_char_specifiers(specifiers: &[CharSpecifier], c: char, options: &MatchOpti
// FIXME: work with non-ascii chars properly (issue #1347)
if !options.case_sensitive && c.is_ascii() && start.is_ascii() && end.is_ascii() {

let start = start.to_ascii().to_lowercase();
let end = end.to_ascii().to_lowercase();
let start = start.to_ascii_lowercase();
let end = end.to_ascii_lowercase();

let start_up = start.to_uppercase();
let end_up = end.to_uppercase();

// only allow case insensitive matching when
// both start and end are within a-z or A-Z
if start != start_up && end != end_up {
let start = start.as_char();
let end = end.as_char();
let c = c.to_ascii().to_lowercase().as_char();
let c = c.to_ascii_lowercase();
if c >= start && c <= end {
return true;
}
Expand All @@ -581,7 +580,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {
true
} else if !case_sensitive && a.is_ascii() && b.is_ascii() {
// FIXME: work with non-ascii chars properly (issue #9084)
a.to_ascii().to_lowercase() == b.to_ascii().to_lowercase()
a.to_ascii_lowercase() == b.to_ascii_lowercase()
} else {
a == b
}
Expand Down