mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Fix clippy warnings
Depends on D96634 Differential Revision: https://phabricator.services.mozilla.com/D96636
This commit is contained in:
parent
191d5226a3
commit
a95ce79554
6 changed files with 13 additions and 16 deletions
|
@ -134,7 +134,7 @@ impl AttrSelectorOperator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The definition of whitespace per CSS Selectors Level 3 § 4.
|
/// The definition of whitespace per CSS Selectors Level 3 § 4.
|
||||||
pub static SELECTOR_WHITESPACE: &'static [char] = &[' ', '\t', '\n', '\r', '\x0C'];
|
pub static SELECTOR_WHITESPACE: &[char] = &[' ', '\t', '\n', '\r', '\x0C'];
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
|
||||||
pub enum ParsedCaseSensitivity {
|
pub enum ParsedCaseSensitivity {
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#selectors>
|
/// <https://html.spec.whatwg.org/multipage/#selectors>
|
||||||
static ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES: &'static str = r#"
|
static ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES: &str = r#"
|
||||||
accept
|
accept
|
||||||
accept-charset
|
accept-charset
|
||||||
align
|
align
|
||||||
|
|
|
@ -286,6 +286,6 @@ where
|
||||||
/// against.
|
/// against.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn shadow_host(&self) -> Option<OpaqueElement> {
|
pub fn shadow_host(&self) -> Option<OpaqueElement> {
|
||||||
self.current_host.clone()
|
self.current_host
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,10 +334,7 @@ where
|
||||||
let result =
|
let result =
|
||||||
matches_complex_selector_internal(iter, element, context, flags_setter, Rightmost::Yes);
|
matches_complex_selector_internal(iter, element, context, flags_setter, Rightmost::Yes);
|
||||||
|
|
||||||
match result {
|
matches!(result, SelectorMatchingResult::Matched)
|
||||||
SelectorMatchingResult::Matched => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -915,9 +912,11 @@ where
|
||||||
element,
|
element,
|
||||||
is_of_type,
|
is_of_type,
|
||||||
is_from_end,
|
is_from_end,
|
||||||
cache.as_mut().map(|s| &mut **s),
|
cache.as_deref_mut(),
|
||||||
);
|
);
|
||||||
cache.as_mut().map(|c| c.insert(element.opaque(), i));
|
if let Some(c) = cache.as_mut() {
|
||||||
|
c.insert(element.opaque(), i)
|
||||||
|
}
|
||||||
i
|
i
|
||||||
};
|
};
|
||||||
debug_assert_eq!(
|
debug_assert_eq!(
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub struct NthIndexCacheInner(FxHashMap<OpaqueElement, i32>);
|
||||||
impl NthIndexCacheInner {
|
impl NthIndexCacheInner {
|
||||||
/// Does a lookup for a given element in the cache.
|
/// Does a lookup for a given element in the cache.
|
||||||
pub fn lookup(&mut self, el: OpaqueElement) -> Option<i32> {
|
pub fn lookup(&mut self, el: OpaqueElement) -> Option<i32> {
|
||||||
self.0.get(&el).map(|x| *x)
|
self.0.get(&el).copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inserts an entry into the cache.
|
/// Inserts an entry into the cache.
|
||||||
|
|
|
@ -493,11 +493,9 @@ where
|
||||||
// :where and :is OR their selectors, so we can't put any hash
|
// :where and :is OR their selectors, so we can't put any hash
|
||||||
// in the filter if there's more than one selector, as that'd
|
// in the filter if there's more than one selector, as that'd
|
||||||
// exclude elements that may match one of the other selectors.
|
// exclude elements that may match one of the other selectors.
|
||||||
if list.len() == 1 {
|
if list.len() == 1 && !collect_ancestor_hashes(list[0].iter(), quirks_mode, hashes, len) {
|
||||||
if !collect_ancestor_hashes(list[0].iter(), quirks_mode, hashes, len) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
_ => continue,
|
_ => continue,
|
||||||
|
@ -2777,8 +2775,8 @@ pub mod tests {
|
||||||
assert!(list.is_ok());
|
assert!(list.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
const MATHML: &'static str = "http://www.w3.org/1998/Math/MathML";
|
const MATHML: &str = "http://www.w3.org/1998/Math/MathML";
|
||||||
const SVG: &'static str = "http://www.w3.org/2000/svg";
|
const SVG: &str = "http://www.w3.org/2000/svg";
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parsing() {
|
fn test_parsing() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue