mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add a fast path for eq_ignore_ascii_case.
This commit is contained in:
parent
98edf5d54d
commit
47fd83da57
1 changed files with 4 additions and 0 deletions
|
@ -239,6 +239,10 @@ impl Atom {
|
||||||
|
|
||||||
/// Return whether two atoms are ASCII-case-insensitive matches
|
/// Return whether two atoms are ASCII-case-insensitive matches
|
||||||
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
|
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
|
||||||
|
if self == other {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
let a = self.as_slice();
|
let a = self.as_slice();
|
||||||
let b = other.as_slice();
|
let b = other.as_slice();
|
||||||
a.len() == b.len() && a.iter().zip(b).all(|(&a16, &b16)| {
|
a.len() == b.len() && a.iter().zip(b).all(|(&a16, &b16)| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue