style: Rustfmt recent changes.

This commit is contained in:
Emilio Cobos Álvarez 2019-06-02 23:09:42 -04:00
parent f7240751f5
commit 665db79274
8 changed files with 46 additions and 26 deletions

View file

@ -314,7 +314,11 @@ impl<T: ?Sized> Arc<T> {
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<T: ?Sized> Arc<T> {
#[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<T: ?Sized> Clone for Arc<T> {

View file

@ -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<Self, ParseError<'i>> {
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)
}
}

View file

@ -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]

View file

@ -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
}
},
}
}

View file

@ -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,
))),
}
}

View file

@ -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};

View file

@ -253,7 +253,6 @@ impl SystemColor {
}
}
#[cfg(feature = "gecko")]
mod gecko {
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]

View file

@ -30,7 +30,8 @@ pub type BoxShadow =
/// A specified value for a single `filter`.
#[cfg(feature = "gecko")]
pub type SpecifiedFilter = GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow, SpecifiedUrl>;
pub type SpecifiedFilter =
GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow, SpecifiedUrl>;
/// A specified value for a single `filter`.
#[cfg(feature = "servo")]