mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Fix tidy issues.
This commit is contained in:
parent
84ca681a78
commit
4c97f68f3e
3 changed files with 13 additions and 15 deletions
|
@ -22,7 +22,7 @@ impl OpaqueElement {
|
||||||
/// Creates a new OpaqueElement from an arbitrarily-typed pointer.
|
/// Creates a new OpaqueElement from an arbitrarily-typed pointer.
|
||||||
pub fn new<T>(ptr: &T) -> Self {
|
pub fn new<T>(ptr: &T) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
OpaqueElement(NonNull::new_unchecked(ptr as *const T as *const () as *mut ()))
|
OpaqueElement(NonNull::new_unchecked(ptr as *const T as *const () as *mut ()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ impl<T> Arc<T> {
|
||||||
/// Convert the Arc<T> to a raw pointer, suitable for use across FFI
|
/// Convert the Arc<T> to a raw pointer, suitable for use across FFI
|
||||||
///
|
///
|
||||||
/// Note: This returns a pointer to the data T, which is offset in the allocation.
|
/// Note: This returns a pointer to the data T, which is offset in the allocation.
|
||||||
///
|
///
|
||||||
/// It is recommended to use RawOffsetArc for this.
|
/// It is recommended to use RawOffsetArc for this.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn into_raw(this: Self) -> *const T {
|
fn into_raw(this: Self) -> *const T {
|
||||||
|
@ -312,7 +312,7 @@ impl<T: Clone> Arc<T> {
|
||||||
///
|
///
|
||||||
/// If this `Arc` is uniquely owned, `make_mut()` will provide a mutable
|
/// If this `Arc` is uniquely owned, `make_mut()` will provide a mutable
|
||||||
/// reference to the contents. If not, `make_mut()` will create a _new_ `Arc`
|
/// reference to the contents. If not, `make_mut()` will create a _new_ `Arc`
|
||||||
/// with a copy of the contents, update `this` to point to it, and provide
|
/// with a copy of the contents, update `this` to point to it, and provide
|
||||||
/// a mutable reference to its contents.
|
/// a mutable reference to its contents.
|
||||||
///
|
///
|
||||||
/// This is useful for implementing copy-on-write schemes where you wish to
|
/// This is useful for implementing copy-on-write schemes where you wish to
|
||||||
|
@ -702,9 +702,11 @@ impl<H, T> ThinArc<H, T> {
|
||||||
F: FnOnce(&Arc<HeaderSliceWithLength<H, [T]>>) -> U,
|
F: FnOnce(&Arc<HeaderSliceWithLength<H, [T]>>) -> U,
|
||||||
{
|
{
|
||||||
// Synthesize transient Arc, which never touches the refcount of the ArcInner.
|
// Synthesize transient Arc, which never touches the refcount of the ArcInner.
|
||||||
let transient = unsafe { NoDrop::new(Arc {
|
let transient = unsafe {
|
||||||
p: ptr::NonNull::new_unchecked(thin_to_thick(self.ptr)),
|
NoDrop::new(Arc {
|
||||||
})};
|
p: ptr::NonNull::new_unchecked(thin_to_thick(self.ptr)),
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
// Expose the transient Arc to the callback, which may clone it if it wants.
|
// Expose the transient Arc to the callback, which may clone it if it wants.
|
||||||
let result = f(&transient);
|
let result = f(&transient);
|
||||||
|
@ -722,7 +724,7 @@ impl<H, T> ThinArc<H, T> {
|
||||||
/// iterator to generate the slice.
|
/// iterator to generate the slice.
|
||||||
pub fn from_header_and_iter<I>(header: H, items: I) -> Self
|
pub fn from_header_and_iter<I>(header: H, items: I) -> Self
|
||||||
where
|
where
|
||||||
I: Iterator<Item = T> + ExactSizeIterator
|
I: Iterator<Item = T> + ExactSizeIterator,
|
||||||
{
|
{
|
||||||
let header = HeaderWithLength::new(header, items.len());
|
let header = HeaderWithLength::new(header, items.len());
|
||||||
Arc::into_thin(Arc::from_header_and_iter(header, items))
|
Arc::into_thin(Arc::from_header_and_iter(header, items))
|
||||||
|
@ -1056,7 +1058,6 @@ pub struct ArcUnion<A, B> {
|
||||||
unsafe impl<A: Sync + Send, B: Send + Sync> Send for ArcUnion<A, B> {}
|
unsafe impl<A: Sync + Send, B: Send + Sync> Send for ArcUnion<A, B> {}
|
||||||
unsafe impl<A: Sync + Send, B: Send + Sync> Sync for ArcUnion<A, B> {}
|
unsafe impl<A: Sync + Send, B: Send + Sync> Sync for ArcUnion<A, B> {}
|
||||||
|
|
||||||
|
|
||||||
impl<A: PartialEq, B: PartialEq> PartialEq for ArcUnion<A, B> {
|
impl<A: PartialEq, B: PartialEq> PartialEq for ArcUnion<A, B> {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
use ArcUnionBorrow::*;
|
use ArcUnionBorrow::*;
|
||||||
|
@ -1104,16 +1105,12 @@ impl<A, B> ArcUnion<A, B> {
|
||||||
|
|
||||||
/// Creates an `ArcUnion` from an instance of the first type.
|
/// Creates an `ArcUnion` from an instance of the first type.
|
||||||
pub fn from_first(other: Arc<A>) -> Self {
|
pub fn from_first(other: Arc<A>) -> Self {
|
||||||
unsafe {
|
unsafe { Self::new(Arc::into_raw(other) as *mut _) }
|
||||||
Self::new(Arc::into_raw(other) as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates an `ArcUnion` from an instance of the second type.
|
/// Creates an `ArcUnion` from an instance of the second type.
|
||||||
pub fn from_second(other: Arc<B>) -> Self {
|
pub fn from_second(other: Arc<B>) -> Self {
|
||||||
unsafe {
|
unsafe { Self::new(((Arc::into_raw(other) as usize) | 0x1) as *mut _) }
|
||||||
Self::new(((Arc::into_raw(other) as usize) | 0x1) as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this `ArcUnion` contains the first type.
|
/// Returns true if this `ArcUnion` contains the first type.
|
||||||
|
|
|
@ -13,7 +13,6 @@ use media_queries::Device;
|
||||||
use properties::{ComputedValues, StyleBuilder};
|
use properties::{ComputedValues, StyleBuilder};
|
||||||
use properties::{LonghandId, LonghandIdSet};
|
use properties::{LonghandId, LonghandIdSet};
|
||||||
use properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator};
|
use properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator};
|
||||||
use properties::{CSSWideKeyword, WideKeywordDeclaration};
|
|
||||||
use properties::CASCADE_PROPERTY;
|
use properties::CASCADE_PROPERTY;
|
||||||
use rule_cache::{RuleCache, RuleCacheConditions};
|
use rule_cache::{RuleCache, RuleCacheConditions};
|
||||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||||
|
@ -790,6 +789,8 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
||||||
self.seen.contains(LonghandId::MozMinFontSizeRatio) ||
|
self.seen.contains(LonghandId::MozMinFontSizeRatio) ||
|
||||||
self.seen.contains(LonghandId::FontFamily)
|
self.seen.contains(LonghandId::FontFamily)
|
||||||
{
|
{
|
||||||
|
use properties::{CSSWideKeyword, WideKeywordDeclaration};
|
||||||
|
|
||||||
// font-size must be explicitly inherited to handle lang
|
// font-size must be explicitly inherited to handle lang
|
||||||
// changes and scriptlevel changes.
|
// changes and scriptlevel changes.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue