style: Pull out the branch from snapshot_helpers::has_class.

I've verified that current libxul, at least for Linux, doesn't manage to pull
the branch out.
This commit is contained in:
Emilio Cobos Álvarez 2018-01-16 21:38:31 +01:00
parent 6f53f4fb5c
commit 1e72a12265
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -32,7 +32,14 @@ pub fn has_class<T>(
1 => case_sensitivity.eq_atom(name, WeakAtom::new(class)),
n => {
let classes = slice::from_raw_parts(list, n as usize);
classes.iter().any(|ptr| case_sensitivity.eq_atom(name, WeakAtom::new(*ptr)))
match case_sensitivity {
CaseSensitivity::CaseSensitive => {
classes.iter().any(|ptr| name == WeakAtom::new(*ptr))
}
CaseSensitivity::AsciiCaseInsensitive => {
classes.iter().any(|ptr| name.eq_ignore_ascii_case(WeakAtom::new(*ptr)))
}
}
}
}
}