Skip to content

Commit

Permalink
style: Rustfmt recent changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Feb 12, 2020
1 parent 1754c83 commit 071ce6f
Show file tree
Hide file tree
Showing 22 changed files with 211 additions and 164 deletions.
12 changes: 5 additions & 7 deletions components/style/custom_properties.rs
Expand Up @@ -12,7 +12,9 @@ use crate::properties::{CSSWideKeyword, CustomDeclaration, CustomDeclarationValu
use crate::selector_map::{PrecomputedHashMap, PrecomputedHashSet, PrecomputedHasher};
use crate::stylesheets::{Origin, PerOrigin};
use crate::Atom;
use cssparser::{CowRcStr, Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType};
use cssparser::{
CowRcStr, Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType,
};
use indexmap::IndexMap;
use selectors::parser::SelectorParseErrorKind;
use servo_arc::Arc;
Expand Down Expand Up @@ -525,10 +527,7 @@ pub struct CustomPropertiesBuilder<'a> {

impl<'a> CustomPropertiesBuilder<'a> {
/// Create a new builder, inheriting from a given custom properties map.
pub fn new(
inherited: Option<&'a Arc<CustomPropertiesMap>>,
device: &'a Device,
) -> Self {
pub fn new(inherited: Option<&'a Arc<CustomPropertiesMap>>, device: &'a Device) -> Self {
Self {
seen: PrecomputedHashSet::default(),
reverted: Default::default(),
Expand Down Expand Up @@ -576,8 +575,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
// environment variable here, perform substitution here instead
// of forcing a full traversal in `substitute_all` afterwards.
let value = if !has_references && unparsed_value.references_environment {
let result =
substitute_references_in_value(unparsed_value, &map, &self.device);
let result = substitute_references_in_value(unparsed_value, &map, &self.device);
match result {
Ok(new_value) => Arc::new(new_value),
Err(..) => {
Expand Down
3 changes: 2 additions & 1 deletion components/style/gecko/media_queries.rs
Expand Up @@ -138,7 +138,8 @@ impl Device {

/// Set the font size of the root element (for rem)
pub fn set_root_font_size(&self, size: Au) {
self.root_font_size.store(size.0 as isize, Ordering::Relaxed)
self.root_font_size
.store(size.0 as isize, Ordering::Relaxed)
}

/// Sets the body text color for the "inherit color from body" quirk.
Expand Down
2 changes: 1 addition & 1 deletion components/style/lib.rs
Expand Up @@ -119,7 +119,7 @@ pub mod attr;
pub mod author_styles;
pub mod bezier;
pub mod bloom;
#[path="properties/computed_value_flags.rs"]
#[path = "properties/computed_value_flags.rs"]
pub mod computed_value_flags;
pub mod context;
pub mod counter_style;
Expand Down
5 changes: 4 additions & 1 deletion components/style/matching.rs
Expand Up @@ -706,7 +706,10 @@ pub trait MatchMethods: TElement {
let new_primary_style = data.styles.primary.as_ref().unwrap();

let mut cascade_requirement = ChildCascadeRequirement::CanSkipCascade;
if new_primary_style.flags.contains(ComputedValueFlags::IS_ROOT_ELEMENT_STYLE) {
if new_primary_style
.flags
.contains(ComputedValueFlags::IS_ROOT_ELEMENT_STYLE)
{
let device = context.shared.stylist.device();
let new_font_size = new_primary_style.get_font().clone_font_size();

Expand Down
6 changes: 3 additions & 3 deletions components/style/properties/computed_value_flags.rs
Expand Up @@ -75,9 +75,9 @@ impl ComputedValueFlags {
#[inline]
fn inherited_flags() -> Self {
ComputedValueFlags::IS_RELEVANT_LINK_VISITED |
ComputedValueFlags::CAN_BE_FRAGMENTED |
ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE |
ComputedValueFlags::HAS_TEXT_DECORATION_LINES
ComputedValueFlags::CAN_BE_FRAGMENTED |
ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE |
ComputedValueFlags::HAS_TEXT_DECORATION_LINES
}

/// Flags that may be propagated to descendants.
Expand Down
11 changes: 9 additions & 2 deletions components/style/rule_tree/mod.rs
Expand Up @@ -1767,12 +1767,19 @@ impl Drop for StrongRuleNode {
crash_str.push(b'\n');
}
children.each(|child| {
(*child.ptr()).source.as_ref().unwrap().dump_unchecked(&mut crash_str);
(*child.ptr())
.source
.as_ref()
.unwrap()
.dump_unchecked(&mut crash_str);
crash_str.push(b'\n');
});
}

panic!("Children left in the rule tree on drop: {}", String::from_utf8_lossy(&crash_str).trim());
panic!(
"Children left in the rule tree on drop: {}",
String::from_utf8_lossy(&crash_str).trim()
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/style/servo/media_queries.rs
Expand Up @@ -16,7 +16,7 @@ use crate::values::KeyframesName;
use app_units::Au;
use cssparser::RGBA;
use euclid::default::Size2D as UntypedSize2D;
use euclid::{Scale, Size2D, SideOffsets2D};
use euclid::{Scale, SideOffsets2D, Size2D};
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel};
Expand Down
2 changes: 1 addition & 1 deletion components/style/sharing/mod.rs
Expand Up @@ -173,7 +173,7 @@ impl ValidationData {
E: TElement,
{
if !element.has_part_attr() {
return &[]
return &[];
}
self.part_list.get_or_insert_with(|| {
let mut list = SmallVec::<[Atom; 5]>::new();
Expand Down
14 changes: 10 additions & 4 deletions components/style/style_adjuster.rs
Expand Up @@ -204,7 +204,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
self.style.pseudo.map_or(false, |p| p.is_marker()) &&
self.style.get_parent_list().clone_list_style_position() ==
ListStylePosition::Outside &&
!layout_parent_style.get_box().clone_display().is_inline_flow()
!layout_parent_style
.get_box()
.clone_display()
.is_inline_flow()
);

if !blockify {
Expand Down Expand Up @@ -241,7 +244,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
}

if self.style.is_root_element {
self.style.add_flags(ComputedValueFlags::IS_ROOT_ELEMENT_STYLE);
self.style
.add_flags(ComputedValueFlags::IS_ROOT_ELEMENT_STYLE);
}

#[cfg(feature = "servo-layout-2013")]
Expand Down Expand Up @@ -285,8 +289,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
let writing_mode = self.style.get_inherited_box().clone_writing_mode();
let text_combine_upright = self.style.get_inherited_text().clone_text_combine_upright();

if matches!(writing_mode, WritingMode::VerticalRl | WritingMode::VerticalLr) &&
text_combine_upright == TextCombineUpright::All
if matches!(
writing_mode,
WritingMode::VerticalRl | WritingMode::VerticalLr
) && text_combine_upright == TextCombineUpright::All
{
self.style.add_flags(ComputedValueFlags::IS_TEXT_COMBINED);
self.style
Expand Down
6 changes: 5 additions & 1 deletion components/style/values/animated/length.rs
Expand Up @@ -30,6 +30,10 @@ impl Animate for LengthPercentage {

// Gets clamped as needed after the animation if needed, so no need to
// specify any particular AllowedNumericType.
Ok(LengthPercentage::new_calc(length, percentage, AllowedNumericType::All))
Ok(LengthPercentage::new_calc(
length,
percentage,
AllowedNumericType::All,
))
}
}
4 changes: 3 additions & 1 deletion components/style/values/computed/align.rs
Expand Up @@ -9,7 +9,9 @@
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified;

pub use super::specified::{AlignContent, AlignItems, ContentDistribution, JustifyContent, SelfAlignment};
pub use super::specified::{
AlignContent, AlignItems, ContentDistribution, JustifyContent, SelfAlignment,
};
pub use super::specified::{AlignSelf, JustifySelf};

/// The computed value for the `justify-items` property.
Expand Down
6 changes: 4 additions & 2 deletions components/style/values/computed/length.rs
Expand Up @@ -21,9 +21,9 @@ use std::ops::{Add, AddAssign, Div, Mul, Neg, Sub};
use style_traits::{CSSPixel, CssWriter, ToCss};

pub use super::image::Image;
pub use super::length_percentage::{LengthPercentage, NonNegativeLengthPercentage};
pub use crate::values::specified::url::UrlOrNone;
pub use crate::values::specified::{Angle, BorderStyle, Time};
pub use super::length_percentage::{LengthPercentage, NonNegativeLengthPercentage};

impl ToComputedValue for specified::NoCalcLength {
type ComputedValue = Length;
Expand Down Expand Up @@ -57,7 +57,9 @@ impl ToComputedValue for specified::Length {
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
match *self {
specified::Length::NoCalc(l) => l.to_computed_value(context),
specified::Length::Calc(ref calc) => calc.to_computed_value(context).to_length().unwrap(),
specified::Length::Calc(ref calc) => {
calc.to_computed_value(context).to_length().unwrap()
},
}
}

Expand Down

0 comments on commit 071ce6f

Please sign in to comment.