From 762abbaf9f886fc4463124d88f54fafab0ca1a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 4 Jun 2020 02:02:50 +0200 Subject: [PATCH] style: Rustfmt recent changes. --- components/selectors/parser.rs | 54 +++++++++------- components/style/build_gecko.rs | 1 + components/style/dom_apis.rs | 15 +++-- components/style/gecko/media_features.rs | 1 - components/style/gecko/pseudo_element.rs | 12 ++-- components/style/gecko/selector_parser.rs | 3 +- .../style/gecko_bindings/sugar/ownership.rs | 4 +- .../invalidation/element/document_state.rs | 5 +- .../invalidation/element/invalidation_map.rs | 23 ++++--- .../style/invalidation/element/invalidator.rs | 61 +++++++++++-------- .../element/state_and_attributes.rs | 17 ++++-- components/style/parser.rs | 10 ++- components/style/selector_map.rs | 11 +++- components/style/values/computed/align.rs | 3 +- components/style/values/computed/mod.rs | 9 ++- components/style/values/specified/align.rs | 16 ++--- components/style/values/specified/mod.rs | 4 +- components/style/values/specified/position.rs | 5 +- components/style_derive/parse.rs | 10 ++- 19 files changed, 163 insertions(+), 101 deletions(-) diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index e66fa75c587..9980bdeeb60 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -144,9 +144,7 @@ impl SelectorParsingState { #[inline] fn allows_non_functional_pseudo_classes(self) -> bool { - !self.intersects( - Self::AFTER_SLOTTED | Self::AFTER_NON_STATEFUL_PSEUDO_ELEMENT, - ) + !self.intersects(Self::AFTER_SLOTTED | Self::AFTER_NON_STATEFUL_PSEUDO_ELEMENT) } #[inline] @@ -354,10 +352,9 @@ impl SelectorList { { let mut values = SmallVec::new(); loop { - values.push( - input - .parse_until_before(Delimiter::Comma, |input| parse_selector(parser, input, state))?, - ); + values.push(input.parse_until_before(Delimiter::Comma, |input| { + parse_selector(parser, input, state) + })?); match input.next() { Err(_) => return Ok(SelectorList(values)), Ok(&Token::Comma) => continue, @@ -382,7 +379,11 @@ where P: Parser<'i, Impl = Impl>, Impl: SelectorImpl, { - parse_selector(parser, input, state | SelectorParsingState::DISALLOW_PSEUDOS | SelectorParsingState::DISALLOW_COMBINATORS) + parse_selector( + parser, + input, + state | SelectorParsingState::DISALLOW_PSEUDOS | SelectorParsingState::DISALLOW_COMBINATORS, + ) } /// Parse a comma separated list of compound selectors. @@ -395,7 +396,9 @@ where Impl: SelectorImpl, { input - .parse_comma_separated(|input| parse_inner_compound_selector(parser, input, SelectorParsingState::empty())) + .parse_comma_separated(|input| { + parse_inner_compound_selector(parser, input, SelectorParsingState::empty()) + }) .map(|selectors| selectors.into_boxed_slice()) } @@ -450,9 +453,7 @@ where }, // In quirks mode, class and id selectors should match // case-insensitively, so just avoid inserting them into the filter. - Component::ID(ref id) if quirks_mode != QuirksMode::Quirks => { - id.precomputed_hash() - }, + Component::ID(ref id) if quirks_mode != QuirksMode::Quirks => id.precomputed_hash(), Component::Class(ref class) if quirks_mode != QuirksMode::Quirks => { class.precomputed_hash() }, @@ -466,7 +467,7 @@ where } } continue; - } + }, _ => continue, }; @@ -1086,11 +1087,14 @@ impl Component { pub fn maybe_allowed_after_pseudo_element(&self) -> bool { match *self { Component::NonTSPseudoClass(..) => true, - Component::Negation(ref components) => components.iter().all(|c| c.maybe_allowed_after_pseudo_element()), - Component::Is(ref selectors) | - Component::Where(ref selectors) => { + Component::Negation(ref components) => components + .iter() + .all(|c| c.maybe_allowed_after_pseudo_element()), + Component::Is(ref selectors) | Component::Where(ref selectors) => { selectors.iter().all(|selector| { - selector.iter_raw_match_order().all(|c| c.maybe_allowed_after_pseudo_element()) + selector + .iter_raw_match_order() + .all(|c| c.maybe_allowed_after_pseudo_element()) }) }, _ => false, @@ -1110,12 +1114,14 @@ impl Component { *self ); match *self { - Component::Negation(ref components) => { - !components.iter().all(|c| c.matches_for_stateless_pseudo_element()) - }, + Component::Negation(ref components) => !components + .iter() + .all(|c| c.matches_for_stateless_pseudo_element()), Component::Is(ref selectors) | Component::Where(ref selectors) => { selectors.iter().any(|selector| { - selector.iter_raw_match_order().all(|c| c.matches_for_stateless_pseudo_element()) + selector + .iter_raw_match_order() + .all(|c| c.matches_for_stateless_pseudo_element()) }) }, _ => false, @@ -2254,7 +2260,11 @@ where // Pseudo-elements cannot be represented by the matches-any // pseudo-class; they are not valid within :is(). // - let inner = SelectorList::parse_with_state(parser, input, state | SelectorParsingState::DISALLOW_PSEUDOS)?; + let inner = SelectorList::parse_with_state( + parser, + input, + state | SelectorParsingState::DISALLOW_PSEUDOS, + )?; Ok(component(inner.0.into_vec().into_boxed_slice())) } diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index a502b7d45f9..dfd2a213d99 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -131,6 +131,7 @@ impl BuilderExt for Builder { // them. let mut builder = Builder::default() .rust_target(RustTarget::Stable_1_25) + .size_t_is_usize(true) .disable_untagged_union(); let rustfmt_path = env::var_os("RUSTFMT") diff --git a/components/style/dom_apis.rs b/components/style/dom_apis.rs index 685b5b4e8a0..f4e814acd11 100644 --- a/components/style/dom_apis.rs +++ b/components/style/dom_apis.rs @@ -7,9 +7,9 @@ use crate::context::QuirksMode; use crate::dom::{TDocument, TElement, TNode, TShadowRoot}; +use crate::invalidation::element::invalidation_map::Dependency; use crate::invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation}; use crate::invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector}; -use crate::invalidation::element::invalidation_map::Dependency; use crate::Atom; use selectors::attr::CaseSensitivity; use selectors::matching::{self, MatchingContext, MatchingMode}; @@ -145,7 +145,10 @@ where } fn check_outer_dependency(&mut self, _: &Dependency, _: E) -> bool { - debug_assert!(false, "How? We should only have parent-less dependencies here!"); + debug_assert!( + false, + "How? We should only have parent-less dependencies here!" + ); true } @@ -647,9 +650,11 @@ pub fn query_selector( if root_element.is_some() || !invalidation_may_be_useful { query_selector_slow::(root, selector_list, results, &mut matching_context); } else { - let dependencies = selector_list.0.iter().map(|selector| { - Dependency::for_full_selector_invalidation(selector.clone()) - }).collect::>(); + let dependencies = selector_list + .0 + .iter() + .map(|selector| Dependency::for_full_selector_invalidation(selector.clone())) + .collect::>(); let mut processor = QuerySelectorProcessor:: { results, matching_context, diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index d11aa0d6893..4d60dc2ff26 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -703,7 +703,6 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 53] = [ keyword_evaluator!(eval_any_hover, Hover), ParsingRequirements::empty(), ), - // Internal -moz-is-glyph media feature: applies only inside SVG glyphs. // Internal because it is really only useful in the user agent anyway // and therefore not worth standardizing. diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index 631172d9511..16e3ab312f4 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -161,11 +161,13 @@ impl PseudoElement { /// Whether this pseudo-element is enabled for all content. pub fn enabled_in_content(&self) -> bool { match *self { - PseudoElement::MozFocusOuter => static_prefs::pref!("layout.css.moz-focus-outer.enabled"), - PseudoElement::FileChooserButton => static_prefs::pref!("layout.css.file-chooser-button.enabled"), - _ => { - (self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) == 0 - } + PseudoElement::MozFocusOuter => { + static_prefs::pref!("layout.css.moz-focus-outer.enabled") + }, + PseudoElement::FileChooserButton => { + static_prefs::pref!("layout.css.file-chooser-button.enabled") + }, + _ => (self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) == 0, } } diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index e5d332df689..fd0494fa4b4 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -343,7 +343,8 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { #[inline] fn parse_is_and_where(&self) -> bool { - self.in_user_agent_stylesheet() || static_prefs::pref!("layout.css.is-where-selectors.enabled") + self.in_user_agent_stylesheet() || + static_prefs::pref!("layout.css.is-where-selectors.enabled") } #[inline] diff --git a/components/style/gecko_bindings/sugar/ownership.rs b/components/style/gecko_bindings/sugar/ownership.rs index 0ece222a1c4..366e4619c68 100644 --- a/components/style/gecko_bindings/sugar/ownership.rs +++ b/components/style/gecko_bindings/sugar/ownership.rs @@ -4,12 +4,12 @@ //! Helpers for different FFI pointer kinds that Gecko's FFI layer uses. +use gecko_bindings::structs::root::mozilla::detail::CopyablePtr; use servo_arc::{Arc, RawOffsetArc}; use std::marker::PhantomData; use std::mem::{forget, transmute}; use std::ops::{Deref, DerefMut}; use std::ptr; -use gecko_bindings::structs::root::mozilla::detail::CopyablePtr; /// Indicates that a given Servo type has a corresponding Gecko FFI type. pub unsafe trait HasFFI: Sized + 'static { @@ -345,4 +345,4 @@ impl DerefMut for CopyablePtr { fn deref_mut<'a>(&'a mut self) -> &'a mut T { &mut self.mPtr } -} \ No newline at end of file +} diff --git a/components/style/invalidation/element/document_state.rs b/components/style/invalidation/element/document_state.rs index 4659eb42f5e..9ee97344a4c 100644 --- a/components/style/invalidation/element/document_state.rs +++ b/components/style/invalidation/element/document_state.rs @@ -67,7 +67,10 @@ where I: Iterator, { fn check_outer_dependency(&mut self, _: &Dependency, _: E) -> bool { - debug_assert!(false, "how, we should only have parent-less dependencies here!"); + debug_assert!( + false, + "how, we should only have parent-less dependencies here!" + ); true } diff --git a/components/style/invalidation/element/invalidation_map.rs b/components/style/invalidation/element/invalidation_map.rs index b822e47545e..6d9b6c1e85d 100644 --- a/components/style/invalidation/element/invalidation_map.rs +++ b/components/style/invalidation/element/invalidation_map.rs @@ -6,7 +6,9 @@ use crate::context::QuirksMode; use crate::element_state::{DocumentState, ElementState}; -use crate::selector_map::{MaybeCaseInsensitiveHashMap, PrecomputedHashMap, SelectorMap, SelectorMapEntry}; +use crate::selector_map::{ + MaybeCaseInsensitiveHashMap, PrecomputedHashMap, SelectorMap, SelectorMapEntry, +}; use crate::selector_parser::SelectorImpl; use crate::{Atom, LocalName, Namespace}; use fallible::FallibleVec; @@ -196,7 +198,8 @@ pub struct InvalidationMap { /// A list of document state dependencies in the rules we represent. pub document_state_selectors: Vec, /// A map of other attribute affecting selectors. - pub other_attribute_affecting_selectors: PrecomputedHashMap>, + pub other_attribute_affecting_selectors: + PrecomputedHashMap>, } impl InvalidationMap { @@ -331,7 +334,11 @@ impl<'a> SelectorDependencyCollector<'a> { self.visit_whole_selector_from(iter, 0) } - fn visit_whole_selector_from(&mut self, mut iter: SelectorIter, mut index: usize) -> bool { + fn visit_whole_selector_from( + &mut self, + mut iter: SelectorIter, + mut index: usize, + ) -> bool { loop { // Reset the compound state. self.compound_state = PerCompoundState::new(index); @@ -384,7 +391,7 @@ impl<'a> SelectorDependencyCollector<'a> { Err(err) => { *self.alloc_error = Some(err); return false; - } + }, } } @@ -395,8 +402,7 @@ impl<'a> SelectorDependencyCollector<'a> { // cache them or something. for &(ref selector, ref selector_offset) in self.parent_selectors.iter() { debug_assert_ne!( - self.compound_state.offset, - 0, + self.compound_state.offset, 0, "Shouldn't bother creating nested dependencies for the rightmost compound", ); let new_parent = Dependency { @@ -442,7 +448,8 @@ impl<'a> SelectorVisitor for SelectorDependencyCollector<'a> { index += 1; // account for the combinator. - self.parent_selectors.push((self.selector.clone(), self.compound_state.offset)); + self.parent_selectors + .push((self.selector.clone(), self.compound_state.offset)); let mut nested = SelectorDependencyCollector { map: &mut *self.map, document_state: &mut *self.document_state, @@ -483,7 +490,7 @@ impl<'a> SelectorVisitor for SelectorDependencyCollector<'a> { Err(err) => { *self.alloc_error = Some(err); return false; - } + }, } }, Component::NonTSPseudoClass(ref pc) => { diff --git a/components/style/invalidation/element/invalidator.rs b/components/style/invalidation/element/invalidator.rs index 8b387bc0c04..c148b63e3e3 100644 --- a/components/style/invalidation/element/invalidator.rs +++ b/components/style/invalidation/element/invalidator.rs @@ -177,13 +177,10 @@ pub struct Invalidation<'a> { impl<'a> Invalidation<'a> { /// Create a new invalidation for matching a dependency. - pub fn new( - dependency: &'a Dependency, - scope: Option, - ) -> Self { + pub fn new(dependency: &'a Dependency, scope: Option) -> Self { debug_assert!( dependency.selector_offset == dependency.selector.len() + 1 || - dependency.invalidation_kind() != DependencyInvalidationKind::Element, + dependency.invalidation_kind() != DependencyInvalidationKind::Element, "No point to this, if the dependency matched the element we should just invalidate it" ); Self { @@ -206,7 +203,11 @@ impl<'a> Invalidation<'a> { // for the weird pseudos in . // // We should be able to do better here! - match self.dependency.selector.combinator_at_parse_order(self.offset - 1) { + match self + .dependency + .selector + .combinator_at_parse_order(self.offset - 1) + { Combinator::Descendant | Combinator::LaterSibling | Combinator::PseudoElement => true, Combinator::Part | Combinator::SlotAssignment | @@ -220,7 +221,11 @@ impl<'a> Invalidation<'a> { return InvalidationKind::Descendant(DescendantInvalidationKind::Dom); } - match self.dependency.selector.combinator_at_parse_order(self.offset - 1) { + match self + .dependency + .selector + .combinator_at_parse_order(self.offset - 1) + { Combinator::Child | Combinator::Descendant | Combinator::PseudoElement => { InvalidationKind::Descendant(DescendantInvalidationKind::Dom) }, @@ -238,7 +243,11 @@ impl<'a> fmt::Debug for Invalidation<'a> { use cssparser::ToCss; f.write_str("Invalidation(")?; - for component in self.dependency.selector.iter_raw_parse_order_from(self.offset) { + for component in self + .dependency + .selector + .iter_raw_parse_order_from(self.offset) + { if matches!(*component, Component::Combinator(..)) { break; } @@ -816,9 +825,11 @@ where let mut cur_dependency = invalidation.dependency; loop { cur_dependency = match cur_dependency.parent { - None => return SingleInvalidationResult { - invalidated_self: true, - matched: true, + None => { + return SingleInvalidationResult { + invalidated_self: true, + matched: true, + } }, Some(ref p) => &**p, }; @@ -828,11 +839,14 @@ where // The inner selector changed, now check if the full // previous part of the selector did, before keeping // checking for descendants. - if !self.processor.check_outer_dependency(cur_dependency, self.element) { + if !self + .processor + .check_outer_dependency(cur_dependency, self.element) + { return SingleInvalidationResult { invalidated_self: false, matched: false, - } + }; } if cur_dependency.invalidation_kind() == DependencyInvalidationKind::Element { @@ -840,24 +854,21 @@ where } debug!(" > Generating invalidation"); - break Invalidation::new(cur_dependency, invalidation.scope) + break Invalidation::new(cur_dependency, invalidation.scope); } }, CompoundSelectorMatchingResult::Matched { next_combinator_offset, - } => { - Invalidation { - dependency: invalidation.dependency, - scope: invalidation.scope, - offset: next_combinator_offset + 1, - matched_by_any_previous: false, - } + } => Invalidation { + dependency: invalidation.dependency, + scope: invalidation.scope, + offset: next_combinator_offset + 1, + matched_by_any_previous: false, }, }; debug_assert_ne!( - next_invalidation.offset, - 0, + next_invalidation.offset, 0, "Rightmost selectors shouldn't generate more invalidations", ); @@ -886,7 +897,9 @@ where c.maybe_allowed_after_pseudo_element(), "Someone seriously messed up selector parsing: \ {:?} at offset {:?}: {:?}", - next_invalidation.dependency, next_invalidation.offset, c, + next_invalidation.dependency, + next_invalidation.offset, + c, ); None diff --git a/components/style/invalidation/element/state_and_attributes.rs b/components/style/invalidation/element/state_and_attributes.rs index 25536eb6bdf..79f1b53ada7 100644 --- a/components/style/invalidation/element/state_and_attributes.rs +++ b/components/style/invalidation/element/state_and_attributes.rs @@ -254,7 +254,9 @@ where ); } let mut attributes_changed = false; - snapshot.each_attr_changed(|_| { attributes_changed = true; }); + snapshot.each_attr_changed(|_| { + attributes_changed = true; + }); if attributes_changed { debug!( " > attributes changed, old: {}", @@ -436,7 +438,12 @@ where /// Check whether a dependency should be taken into account. #[inline] fn check_dependency(&mut self, dependency: &Dependency) -> bool { - check_dependency(dependency, &self.element, &self.wrapper, &mut self.matching_context) + check_dependency( + dependency, + &self.element, + &self.wrapper, + &mut self.matching_context, + ) } fn scan_dependency(&mut self, dependency: &'selectors Dependency) { @@ -472,10 +479,8 @@ where debug_assert_ne!(dependency.selector_offset, 0); debug_assert_ne!(dependency.selector_offset, dependency.selector.len()); - let invalidation = Invalidation::new( - &dependency, - self.matching_context.current_host.clone(), - ); + let invalidation = + Invalidation::new(&dependency, self.matching_context.current_host.clone()); match invalidation_kind { DependencyInvalidationKind::Element => unreachable!(), diff --git a/components/style/parser.rs b/components/style/parser.rs index f506b809955..26e7cab1ad9 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -208,13 +208,19 @@ where } impl Parse for crate::OwnedStr { - fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { + fn parse<'i, 't>( + _: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { Ok(input.expect_string()?.as_ref().to_owned().into()) } } impl Parse for UnicodeRange { - fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { + fn parse<'i, 't>( + _: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { Ok(UnicodeRange::parse(input)?) } } diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index 2088a5baab1..6350caef0cf 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -331,8 +331,9 @@ impl SelectorMap { .try_entry(url.clone())? .or_insert_with(SmallVec::new), Bucket::Universal => &mut self.other, - }.try_push($entry)?; - }} + } + .try_push($entry)?; + }}; } let bucket = { @@ -354,7 +355,11 @@ impl SelectorMap { // This is specially true if there's any universal selector in the // `disjoint_selectors` set, at which point we'd just be doing // wasted work. - if !disjoint_buckets.is_empty() && disjoint_buckets.iter().all(|b| b.more_specific_than(&bucket)) { + if !disjoint_buckets.is_empty() && + disjoint_buckets + .iter() + .all(|b| b.more_specific_than(&bucket)) + { for bucket in &disjoint_buckets { let entry = entry.clone(); insert_into_bucket!(entry, *bucket); diff --git a/components/style/values/computed/align.rs b/components/style/values/computed/align.rs index 5cfb53f89ee..94847fd80f0 100644 --- a/components/style/values/computed/align.rs +++ b/components/style/values/computed/align.rs @@ -10,7 +10,8 @@ use crate::values::computed::{Context, ToComputedValue}; use crate::values::specified; pub use super::specified::{ - AlignContent, AlignItems, AlignTracks, ContentDistribution, JustifyContent, JustifyTracks, SelfAlignment, + AlignContent, AlignItems, AlignTracks, ContentDistribution, JustifyContent, JustifyTracks, + SelfAlignment, }; pub use super::specified::{AlignSelf, JustifySelf}; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index f2d29eecac3..547c1618f70 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -29,7 +29,10 @@ use std::cmp; use std::f32; #[cfg(feature = "gecko")] -pub use self::align::{AlignContent, AlignItems, AlignTracks, JustifyContent, JustifyItems, JustifyTracks, SelfAlignment}; +pub use self::align::{ + AlignContent, AlignItems, AlignTracks, JustifyContent, JustifyItems, JustifyTracks, + SelfAlignment, +}; #[cfg(feature = "gecko")] pub use self::align::{AlignSelf, JustifySelf}; pub use self::angle::Angle; @@ -69,7 +72,9 @@ pub use self::motion::{OffsetPath, OffsetRotate}; pub use self::outline::OutlineStyle; pub use self::percentage::{NonNegativePercentage, Percentage}; pub use self::position::AspectRatio; -pub use self::position::{GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto, ZIndex}; +pub use self::position::{ + GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto, ZIndex, +}; pub use self::rect::NonNegativeLengthOrNumberRect; pub use self::resolution::Resolution; pub use self::svg::MozContextProperties; diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs index 4b483962f2f..51b5e625672 100644 --- a/components/style/values/specified/align.rs +++ b/components/style/values/specified/align.rs @@ -300,19 +300,14 @@ impl SpecifiedValueInfo for AlignContent { )] #[repr(transparent)] #[css(comma)] -pub struct AlignTracks( - #[css(iterable, if_empty = "normal")] - pub crate::OwnedSlice -); +pub struct AlignTracks(#[css(iterable, if_empty = "normal")] pub crate::OwnedSlice); impl Parse for AlignTracks { fn parse<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - let values = input.parse_comma_separated(|input| { - AlignContent::parse(context, input) - })?; + let values = input.parse_comma_separated(|input| AlignContent::parse(context, input))?; Ok(AlignTracks(values.into())) } } @@ -373,8 +368,7 @@ impl SpecifiedValueInfo for JustifyContent { #[repr(transparent)] #[css(comma)] pub struct JustifyTracks( - #[css(iterable, if_empty = "normal")] - pub crate::OwnedSlice + #[css(iterable, if_empty = "normal")] pub crate::OwnedSlice, ); impl Parse for JustifyTracks { @@ -382,9 +376,7 @@ impl Parse for JustifyTracks { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - let values = input.parse_comma_separated(|input| { - JustifyContent::parse(context, input) - })?; + let values = input.parse_comma_separated(|input| JustifyContent::parse(context, input))?; Ok(JustifyTracks(values.into())) } } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index e45be0513a4..4bb910fc97d 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -72,7 +72,9 @@ pub use self::motion::{OffsetPath, OffsetRotate}; pub use self::outline::OutlineStyle; pub use self::percentage::Percentage; pub use self::position::AspectRatio; -pub use self::position::{GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto}; +pub use self::position::{ + GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto, +}; pub use self::position::{PositionComponent, ZIndex}; pub use self::rect::NonNegativeLengthOrNumberRect; pub use self::resolution::Resolution; diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index 95e1e2ec712..c2998de328b 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -452,13 +452,12 @@ pub struct MasonryAutoFlow { #[inline] fn is_pack_with_non_default_order(placement: &MasonryPlacement, order: &MasonryItemOrder) -> bool { - *placement == MasonryPlacement::Pack && - *order != MasonryItemOrder::DefiniteFirst + *placement == MasonryPlacement::Pack && *order != MasonryItemOrder::DefiniteFirst } #[inline] fn is_item_order_definite_first(order: &MasonryItemOrder) -> bool { - *order == MasonryItemOrder::DefiniteFirst + *order == MasonryItemOrder::DefiniteFirst } impl MasonryAutoFlow { diff --git a/components/style_derive/parse.rs b/components/style_derive/parse.rs index 6dc2c8a715b..ebf46a3735e 100644 --- a/components/style_derive/parse.rs +++ b/components/style_derive/parse.rs @@ -154,8 +154,14 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { let mut parse_non_keywords = quote! {}; for (i, (variant, css_attrs, parse_attrs)) in non_keywords.iter().enumerate() { let skip_try = !has_keywords && i == non_keywords.len() - 1; - let parse_variant = - parse_non_keyword_variant(&mut where_clause, name, variant, css_attrs, parse_attrs, skip_try); + let parse_variant = parse_non_keyword_variant( + &mut where_clause, + name, + variant, + css_attrs, + parse_attrs, + skip_try, + ); parse_non_keywords.extend(parse_variant); }