diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index 8d68d318308..aa79140e044 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -314,7 +314,11 @@ impl Arc { fn record_drop(&self) { #[cfg(feature = "gecko_refcount_logging")] unsafe { - NS_LogDtor(self.ptr() as *const _, b"ServoArc\0".as_ptr() as *const _, 8); + NS_LogDtor( + self.ptr() as *const _, + b"ServoArc\0".as_ptr() as *const _, + 8, + ); } } @@ -350,8 +354,16 @@ impl Arc { #[cfg(feature = "gecko_refcount_logging")] extern "C" { - fn NS_LogCtor(aPtr: *const std::os::raw::c_void, aTypeName: *const std::os::raw::c_char, aSize: u32); - fn NS_LogDtor(aPtr: *const std::os::raw::c_void, aTypeName: *const std::os::raw::c_char, aSize: u32); + fn NS_LogCtor( + aPtr: *const std::os::raw::c_void, + aTypeName: *const std::os::raw::c_char, + aSize: u32, + ); + fn NS_LogDtor( + aPtr: *const std::os::raw::c_void, + aTypeName: *const std::os::raw::c_char, + aSize: u32, + ); } impl Clone for Arc { diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index 4f1efdf052c..f8d0f4ec72e 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -9,7 +9,7 @@ use crate::gecko_bindings::structs; use crate::gecko_bindings::structs::nsStyleImageRequest; use crate::gecko_bindings::sugar::refptr::RefPtr; use crate::parser::{Parse, ParserContext}; -use crate::stylesheets::{UrlExtraData, CorsMode}; +use crate::stylesheets::{CorsMode, UrlExtraData}; use crate::values::computed::{Context, ToComputedValue}; use cssparser::Parser; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; @@ -68,15 +68,15 @@ impl CssUrl { cors_mode: CorsMode, ) -> Result> { let url = input.expect_url()?; - Ok(Self::parse_from_string(url.as_ref().to_owned(), context, cors_mode)) + Ok(Self::parse_from_string( + url.as_ref().to_owned(), + context, + cors_mode, + )) } /// Parse a URL from a string value that is a valid CSS token for a URL. - pub fn parse_from_string( - url: String, - context: &ParserContext, - cors_mode: CorsMode, - ) -> Self { + pub fn parse_from_string(url: String, context: &ParserContext, cors_mode: CorsMode) -> Self { CssUrl(Arc::new(CssUrlData { serialization: url.into(), extra_data: context.url_data.clone(), @@ -261,7 +261,11 @@ pub struct SpecifiedImageUrl(pub SpecifiedUrl); impl SpecifiedImageUrl { /// Parse a URL from a string value that is a valid CSS token for a URL. pub fn parse_from_string(url: String, context: &ParserContext) -> Self { - SpecifiedImageUrl(SpecifiedUrl::parse_from_string(url, context, CorsMode::None)) + SpecifiedImageUrl(SpecifiedUrl::parse_from_string( + url, + context, + CorsMode::None, + )) } /// Provides an alternate method for parsing that associates the URL @@ -354,7 +358,8 @@ impl ToCss for ComputedImageUrl { where W: Write, { - self.0.serialize_with(bindings::Gecko_GetComputedImageURLSpec, dest) + self.0 + .serialize_with(bindings::Gecko_GetComputedImageURLSpec, dest) } } diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 3b784a6080f..fadb0aefe52 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -704,8 +704,8 @@ impl<'le> GeckoElement<'le> { .map(GeckoElement) } } else { - let binding_parent = unsafe { self.non_xul_xbl_binding_parent().as_ref() } - .map(GeckoElement); + let binding_parent = + unsafe { self.non_xul_xbl_binding_parent().as_ref() }.map(GeckoElement); debug_assert!( binding_parent == @@ -722,9 +722,8 @@ impl<'le> GeckoElement<'le> { #[inline] fn non_xul_xbl_binding_parent(&self) -> *mut RawGeckoElement { debug_assert!(!self.is_xul_element()); - self.extended_slots().map_or(ptr::null_mut(), |slots| { - slots._base.mBindingParent.mRawPtr - }) + self.extended_slots() + .map_or(ptr::null_mut(), |slots| slots._base.mBindingParent.mRawPtr) } #[inline] diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 773f418579b..288f68aaf3b 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -84,7 +84,11 @@ impl MallocSizeOf for RuleTree { while let Some(node) = stack.pop() { n += unsafe { ops.malloc_size_of(node.ptr()) }; stack.extend(unsafe { - (*node.ptr()).children.read().iter().map(|(_k, v)| v.clone()) + (*node.ptr()) + .children + .read() + .iter() + .map(|(_k, v)| v.clone()) }); } @@ -958,9 +962,7 @@ impl StrongRuleNode { } match RwLockUpgradableReadGuard::upgrade(read_guard).entry(key) { - hash::map::Entry::Occupied(ref occupied) => { - occupied.get().upgrade() - } + hash::map::Entry::Occupied(ref occupied) => occupied.get().upgrade(), hash::map::Entry::Vacant(vacant) => { let new_node = StrongRuleNode::new(Box::new(RuleNode::new( root, @@ -972,7 +974,7 @@ impl StrongRuleNode { vacant.insert(new_node.downgrade()); new_node - } + }, } } diff --git a/components/style/shared_lock.rs b/components/style/shared_lock.rs index 3931a841bab..a29d97a9814 100644 --- a/components/style/shared_lock.rs +++ b/components/style/shared_lock.rs @@ -75,7 +75,9 @@ impl SharedRwLock { #[cfg(feature = "gecko")] pub fn new_leaked() -> Self { SharedRwLock { - cell: Some(Arc::new_leaked(AtomicRefCell::new(SomethingZeroSizedButTyped))), + cell: Some(Arc::new_leaked(AtomicRefCell::new( + SomethingZeroSizedButTyped, + ))), } } diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs index 6b070317610..e7f3fb15f80 100644 --- a/components/style/stylesheets/rule_parser.rs +++ b/components/style/stylesheets/rule_parser.rs @@ -19,8 +19,8 @@ use crate::stylesheets::keyframes_rule::parse_keyframe_list; use crate::stylesheets::stylesheet::Namespaces; use crate::stylesheets::supports_rule::SupportsCondition; use crate::stylesheets::viewport_rule; -use crate::stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader}; use crate::stylesheets::{CorsMode, DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule}; +use crate::stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader}; use crate::stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule}; use crate::values::computed::font::FamilyName; use crate::values::{CssUrl, CustomIdent, KeyframesName}; diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 48918d5bb22..6485c97c0dd 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -253,7 +253,6 @@ impl SystemColor { } } - #[cfg(feature = "gecko")] mod gecko { #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)] diff --git a/components/style/values/specified/effects.rs b/components/style/values/specified/effects.rs index 24af52d1556..25ef99a362e 100644 --- a/components/style/values/specified/effects.rs +++ b/components/style/values/specified/effects.rs @@ -30,7 +30,8 @@ pub type BoxShadow = /// A specified value for a single `filter`. #[cfg(feature = "gecko")] -pub type SpecifiedFilter = GenericFilter; +pub type SpecifiedFilter = + GenericFilter; /// A specified value for a single `filter`. #[cfg(feature = "servo")]