mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Use ascii_case_insensitive_phf_map! in PropertyId::parse
This commit is contained in:
parent
33ef6f78e5
commit
2f996e34f5
7 changed files with 21 additions and 69 deletions
|
@ -7,8 +7,6 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use num_traits::ToPrimitive;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::Cow;
|
||||
use std::convert::AsRef;
|
||||
use std::iter::{Filter, Peekable};
|
||||
use std::str::Split;
|
||||
|
@ -146,12 +144,3 @@ pub fn str_join<I, T>(strs: I, join: &str) -> String
|
|||
acc
|
||||
})
|
||||
}
|
||||
|
||||
/// Like AsciiExt::to_ascii_lowercase, but avoids allocating when the input is already lower-case.
|
||||
pub fn cow_into_ascii_lowercase<'a, S: Into<Cow<'a, str>>>(s: S) -> Cow<'a, str> {
|
||||
let mut cow = s.into();
|
||||
if let Some(first_uppercase) = cow.bytes().position(|byte| byte >= b'A' && byte <= b'Z') {
|
||||
cow.to_mut()[first_uppercase..].make_ascii_lowercase();
|
||||
}
|
||||
cow
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue