mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Run rustfmt on selectors, servo_arc, and style.
This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
This commit is contained in:
parent
f7ae1a37e3
commit
c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions
|
@ -11,7 +11,7 @@ use std::ops::{Deref, DerefMut};
|
|||
use std::ptr;
|
||||
|
||||
/// Indicates that a given Servo type has a corresponding Gecko FFI type.
|
||||
pub unsafe trait HasFFI : Sized + 'static {
|
||||
pub unsafe trait HasFFI: Sized + 'static {
|
||||
/// The corresponding Gecko type that this rust type represents.
|
||||
///
|
||||
/// See the examples in `components/style/gecko/conversions.rs`.
|
||||
|
@ -20,7 +20,7 @@ pub unsafe trait HasFFI : Sized + 'static {
|
|||
|
||||
/// Indicates that a given Servo type has the same layout as the corresponding
|
||||
/// `HasFFI::FFIType` type.
|
||||
pub unsafe trait HasSimpleFFI : HasFFI {
|
||||
pub unsafe trait HasSimpleFFI: HasFFI {
|
||||
#[inline]
|
||||
/// Given a Servo-side reference, converts it to an FFI-safe reference which
|
||||
/// can be passed to Gecko.
|
||||
|
@ -57,7 +57,7 @@ pub unsafe trait HasSimpleFFI : HasFFI {
|
|||
|
||||
/// Indicates that the given Servo type is passed over FFI
|
||||
/// as a Box
|
||||
pub unsafe trait HasBoxFFI : HasSimpleFFI {
|
||||
pub unsafe trait HasBoxFFI: HasSimpleFFI {
|
||||
#[inline]
|
||||
/// Converts a borrowed Arc to a borrowed FFI reference.
|
||||
///
|
||||
|
@ -73,7 +73,7 @@ pub unsafe trait HasBoxFFI : HasSimpleFFI {
|
|||
/// and Borrowed.
|
||||
///
|
||||
/// In this case, the FFIType is the rough equivalent of ArcInner<Self>.
|
||||
pub unsafe trait HasArcFFI : HasFFI {
|
||||
pub unsafe trait HasArcFFI: HasFFI {
|
||||
// these methods can't be on Borrowed because it leads to an unspecified
|
||||
// impl parameter
|
||||
/// Artificially increments the refcount of a (possibly null) borrowed Arc
|
||||
|
@ -109,9 +109,7 @@ pub unsafe trait HasArcFFI : HasFFI {
|
|||
///
|
||||
/// &GeckoType -> &Arc<ServoType>
|
||||
fn as_arc<'a>(ptr: &'a &Self::FFIType) -> &'a RawOffsetArc<Self> {
|
||||
unsafe {
|
||||
transmute::<&&Self::FFIType, &RawOffsetArc<Self>>(ptr)
|
||||
}
|
||||
unsafe { transmute::<&&Self::FFIType, &RawOffsetArc<Self>>(ptr) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -119,9 +117,7 @@ pub unsafe trait HasArcFFI : HasFFI {
|
|||
///
|
||||
/// &Arc<ServoType> -> &GeckoType
|
||||
fn arc_as_borrowed<'a>(arc: &'a RawOffsetArc<Self>) -> &'a &Self::FFIType {
|
||||
unsafe {
|
||||
transmute::<&RawOffsetArc<Self>, &&Self::FFIType>(arc)
|
||||
}
|
||||
unsafe { transmute::<&RawOffsetArc<Self>, &&Self::FFIType>(arc) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -165,7 +161,8 @@ impl<GeckoType> Strong<GeckoType> {
|
|||
///
|
||||
/// Strong<GeckoType> -> Arc<ServoType>
|
||||
pub fn into_arc<ServoType>(self) -> RawOffsetArc<ServoType>
|
||||
where ServoType: HasArcFFI<FFIType = GeckoType>,
|
||||
where
|
||||
ServoType: HasArcFFI<FFIType = GeckoType>,
|
||||
{
|
||||
self.into_arc_opt().unwrap()
|
||||
}
|
||||
|
@ -177,7 +174,8 @@ impl<GeckoType> Strong<GeckoType> {
|
|||
///
|
||||
/// Strong<GeckoType> -> Arc<ServoType>
|
||||
pub fn into_arc_opt<ServoType>(self) -> Option<RawOffsetArc<ServoType>>
|
||||
where ServoType: HasArcFFI<FFIType = GeckoType>,
|
||||
where
|
||||
ServoType: HasArcFFI<FFIType = GeckoType>,
|
||||
{
|
||||
if self.is_null() {
|
||||
None
|
||||
|
@ -194,7 +192,8 @@ impl<GeckoType> Strong<GeckoType> {
|
|||
///
|
||||
/// Strong<GeckoType> -> Arc<ServoType>
|
||||
pub fn as_arc_opt<ServoType>(&self) -> Option<&RawOffsetArc<ServoType>>
|
||||
where ServoType: HasArcFFI<FFIType = GeckoType>,
|
||||
where
|
||||
ServoType: HasArcFFI<FFIType = GeckoType>,
|
||||
{
|
||||
if self.is_null() {
|
||||
None
|
||||
|
@ -271,7 +270,8 @@ pub struct Owned<GeckoType> {
|
|||
impl<GeckoType> Owned<GeckoType> {
|
||||
/// Gets this `Owned` type as a `Box<ServoType>`.
|
||||
pub fn into_box<ServoType>(self) -> Box<ServoType>
|
||||
where ServoType: HasBoxFFI<FFIType = GeckoType>,
|
||||
where
|
||||
ServoType: HasBoxFFI<FFIType = GeckoType>,
|
||||
{
|
||||
unsafe { transmute(self) }
|
||||
}
|
||||
|
@ -313,7 +313,8 @@ impl<GeckoType> OwnedOrNull<GeckoType> {
|
|||
|
||||
/// Returns an owned pointer if this is non-null, and `None` otherwise.
|
||||
pub fn into_box_opt<ServoType>(self) -> Option<Box<ServoType>>
|
||||
where ServoType: HasBoxFFI<FFIType = GeckoType>,
|
||||
where
|
||||
ServoType: HasBoxFFI<FFIType = GeckoType>,
|
||||
{
|
||||
if self.is_null() {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue