File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 11[package ]
22
33name = " string_cache"
4- version = " 0.5.0 " # Also update README.md when making a semver-breaking change
4+ version = " 0.5.1 " # Also update README.md when making a semver-breaking change
55authors = [ " The Servo Project Developers" ]
66description = " A string interning library for Rust, developed as part of the Servo project."
77license = " MIT / Apache-2.0"
Original file line number Diff line number Diff line change @@ -470,19 +470,21 @@ impl<Static: StaticAtomSet> Deserialize for Atom<Static> {
470470// over the one from &str.
471471impl < Static : StaticAtomSet > Atom < Static > {
472472 pub fn to_ascii_uppercase ( & self ) -> Self {
473- if self . chars ( ) . all ( char :: is_uppercase ) {
474- self . clone ( )
475- } else {
476- Atom :: from ( & * ( ( & * * self ) . to_ascii_uppercase ( ) ) )
473+ for b in self . bytes ( ) {
474+ if let b'a' ... b'z' = b {
475+ return Atom :: from ( ( & * * self ) . to_ascii_uppercase ( ) )
476+ }
477477 }
478+ self . clone ( )
478479 }
479480
480481 pub fn to_ascii_lowercase ( & self ) -> Self {
481- if self . chars ( ) . all ( char :: is_lowercase ) {
482- self . clone ( )
483- } else {
484- Atom :: from ( & * ( ( & * * self ) . to_ascii_lowercase ( ) ) )
482+ for b in self . bytes ( ) {
483+ if let b'A' ... b'Z' = b {
484+ return Atom :: from ( ( & * * self ) . to_ascii_lowercase ( ) )
485+ }
485486 }
487+ self . clone ( )
486488 }
487489
488490 pub fn eq_ignore_ascii_case ( & self , other : & Self ) -> bool {
You can’t perform that action at this time.
0 commit comments