Skip to content

Commit 317710e

Browse files
author
doug
committed
Fixes for changes the ascii api in rust-lang/rust#19916
1 parent 3c18564 commit 317710e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "glob"
4-
version = "0.1.2"
4+
version = "0.1.3"
55
authors = ["The Rust Project Developers"]
66
license = "MIT/Apache-2.0"
77
homepage = "https://github.com/rust-lang/glob"

src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use std::{cmp, os, path};
2929
use std::io::fs::{mod, PathExtensions};
3030
use std::path::is_sep;
3131
use std::string::String;
32+
use std::ascii::AsciiExt;
3233

3334
use PatternToken::{Char, AnyChar, AnySequence, AnyRecursiveSequence, AnyWithin, AnyExcept};
3435
use 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

Comments
 (0)