style: Fix tidy issues.

This commit is contained in:
Emilio Cobos Álvarez 2018-12-15 03:50:09 +01:00
parent 28719f2455
commit 273705d7fb
6 changed files with 17 additions and 32 deletions

View file

@ -472,7 +472,7 @@ macro_rules! malloc_size_of_hash_set {
n n
} }
} }
} };
} }
malloc_size_of_hash_set!(std::collections::HashSet<T, S>); malloc_size_of_hash_set!(std::collections::HashSet<T, S>);
@ -513,7 +513,7 @@ macro_rules! malloc_size_of_hash_map {
n n
} }
} }
} };
} }
malloc_size_of_hash_map!(std::collections::HashMap<K, V, S>); malloc_size_of_hash_map!(std::collections::HashMap<K, V, S>);

View file

@ -155,8 +155,7 @@ impl ParsedCaseSensitivity {
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument => { ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument => {
CaseSensitivity::CaseSensitive CaseSensitivity::CaseSensitive
}, },
ParsedCaseSensitivity::CaseSensitive | ParsedCaseSensitivity::CaseSensitive | ParsedCaseSensitivity::ExplicitCaseSensitive => {
ParsedCaseSensitivity::ExplicitCaseSensitive => {
CaseSensitivity::CaseSensitive CaseSensitivity::CaseSensitive
}, },
ParsedCaseSensitivity::AsciiCaseInsensitive => CaseSensitivity::AsciiCaseInsensitive, ParsedCaseSensitivity::AsciiCaseInsensitive => CaseSensitivity::AsciiCaseInsensitive,

View file

@ -521,12 +521,8 @@ where
Combinator::PseudoElement => SelectorMatchingResult::NotMatchedGlobally, Combinator::PseudoElement => SelectorMatchingResult::NotMatchedGlobally,
}; };
let mut next_element = next_element_for_combinator( let mut next_element =
element, next_element_for_combinator(element, combinator, &selector_iter, &context);
combinator,
&selector_iter,
&context,
);
// Stop matching :visited as soon as we find a link, or a combinator for // Stop matching :visited as soon as we find a link, or a combinator for
// something that isn't an ancestor. // something that isn't an ancestor.
@ -590,12 +586,7 @@ where
visited_handling = VisitedHandlingMode::AllLinksUnvisited; visited_handling = VisitedHandlingMode::AllLinksUnvisited;
} }
next_element = next_element_for_combinator( next_element = next_element_for_combinator(&element, combinator, &selector_iter, &context);
&element,
combinator,
&selector_iter,
&context,
);
} }
} }

View file

@ -1721,7 +1721,8 @@ where
let case_sensitivity; let case_sensitivity;
{ {
let local_name_lower_cow = to_ascii_lowercase(&local_name); let local_name_lower_cow = to_ascii_lowercase(&local_name);
case_sensitivity = attribute_flags.to_case_sensitivity(local_name_lower_cow.as_ref(), namespace.is_some()); case_sensitivity =
attribute_flags.to_case_sensitivity(local_name_lower_cow.as_ref(), namespace.is_some());
local_name_lower = local_name_lower_cow.as_ref().into(); local_name_lower = local_name_lower_cow.as_ref().into();
local_name_is_ascii_lowercase = matches!(local_name_lower_cow, Cow::Borrowed(..)); local_name_is_ascii_lowercase = matches!(local_name_lower_cow, Cow::Borrowed(..));
} }
@ -1758,20 +1759,14 @@ enum AttributeFlags {
// Matching should be case-insensitive ('i' flag). // Matching should be case-insensitive ('i' flag).
AsciiCaseInsensitive, AsciiCaseInsensitive,
// No flags. Matching behavior depends on the name of the attribute. // No flags. Matching behavior depends on the name of the attribute.
CaseSensitivityDependsOnName CaseSensitivityDependsOnName,
} }
impl AttributeFlags { impl AttributeFlags {
fn to_case_sensitivity( fn to_case_sensitivity(self, local_name: &str, have_namespace: bool) -> ParsedCaseSensitivity {
self,
local_name: &str,
have_namespace: bool,
) -> ParsedCaseSensitivity {
match self { match self {
AttributeFlags::CaseSensitive => AttributeFlags::CaseSensitive => ParsedCaseSensitivity::ExplicitCaseSensitive,
ParsedCaseSensitivity::ExplicitCaseSensitive, AttributeFlags::AsciiCaseInsensitive => ParsedCaseSensitivity::AsciiCaseInsensitive,
AttributeFlags::AsciiCaseInsensitive =>
ParsedCaseSensitivity::AsciiCaseInsensitive,
AttributeFlags::CaseSensitivityDependsOnName => { AttributeFlags::CaseSensitivityDependsOnName => {
if !have_namespace && include!(concat!( if !have_namespace && include!(concat!(
env!("OUT_DIR"), env!("OUT_DIR"),
@ -1783,7 +1778,7 @@ impl AttributeFlags {
} else { } else {
ParsedCaseSensitivity::CaseSensitive ParsedCaseSensitivity::CaseSensitive
} }
} },
} }
} }
} }
@ -1798,7 +1793,7 @@ fn parse_attribute_flags<'i, 't>(
// Selectors spec says language-defined; HTML says it depends on the // Selectors spec says language-defined; HTML says it depends on the
// exact attribute name. // exact attribute name.
return Ok(AttributeFlags::CaseSensitivityDependsOnName); return Ok(AttributeFlags::CaseSensitivityDependsOnName);
} },
}; };
let ident = match *token { let ident = match *token {

View file

@ -12,7 +12,7 @@ use std::fmt::Debug;
use std::ptr::NonNull; use std::ptr::NonNull;
/// Opaque representation of an Element, for identity comparisons. /// Opaque representation of an Element, for identity comparisons.
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct OpaqueElement(NonNull<()>); pub struct OpaqueElement(NonNull<()>);
unsafe impl Send for OpaqueElement {} unsafe impl Send for OpaqueElement {}

View file

@ -43,7 +43,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
pub use self::border::{BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageSlice, BorderImageWidth};
pub use self::box_::{AnimationIterationCount, AnimationName, Contain}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float}; pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
pub use self::box_::{Display, TransitionProperty, Overflow}; pub use self::box_::{Display, Overflow, TransitionProperty};
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange}; pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange};
pub use self::color::{Color, ColorPropertyValue, RGBAColor}; pub use self::color::{Color, ColorPropertyValue, RGBAColor};