mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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.
|
||||
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)]
|
||||
pub enum ParsedCaseSensitivity {
|
||||
|
|
|
@ -27,7 +27,7 @@ fn main() {
|
|||
}
|
||||
|
||||
/// <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-charset
|
||||
align
|
||||
|
|
|
@ -286,6 +286,6 @@ where
|
|||
/// against.
|
||||
#[inline]
|
||||
pub fn shadow_host(&self) -> Option<OpaqueElement> {
|
||||
self.current_host.clone()
|
||||
self.current_host
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,10 +334,7 @@ where
|
|||
let result =
|
||||
matches_complex_selector_internal(iter, element, context, flags_setter, Rightmost::Yes);
|
||||
|
||||
match result {
|
||||
SelectorMatchingResult::Matched => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(result, SelectorMatchingResult::Matched)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -915,9 +912,11 @@ where
|
|||
element,
|
||||
is_of_type,
|
||||
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
|
||||
};
|
||||
debug_assert_eq!(
|
||||
|
|
|
@ -37,7 +37,7 @@ pub struct NthIndexCacheInner(FxHashMap<OpaqueElement, i32>);
|
|||
impl NthIndexCacheInner {
|
||||
/// Does a lookup for a given element in the cache.
|
||||
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.
|
||||
|
|
|
@ -493,10 +493,8 @@ where
|
|||
// :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
|
||||
// exclude elements that may match one of the other selectors.
|
||||
if list.len() == 1 {
|
||||
if !collect_ancestor_hashes(list[0].iter(), quirks_mode, hashes, len) {
|
||||
return false;
|
||||
}
|
||||
if list.len() == 1 && !collect_ancestor_hashes(list[0].iter(), quirks_mode, hashes, len) {
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
},
|
||||
|
@ -2777,8 +2775,8 @@ pub mod tests {
|
|||
assert!(list.is_ok());
|
||||
}
|
||||
|
||||
const MATHML: &'static str = "http://www.w3.org/1998/Math/MathML";
|
||||
const SVG: &'static str = "http://www.w3.org/2000/svg";
|
||||
const MATHML: &str = "http://www.w3.org/1998/Math/MathML";
|
||||
const SVG: &str = "http://www.w3.org/2000/svg";
|
||||
|
||||
#[test]
|
||||
fn test_parsing() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue