style: Fix formatting.

This commit is contained in:
Emilio Cobos Álvarez 2018-11-17 09:48:01 +01:00
parent cd75cd6a86
commit 06fe0a1fc0
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 34 additions and 20 deletions

View file

@ -335,7 +335,8 @@ impl VariableValue {
let (first_token_type, css, last_token_type) = let (first_token_type, css, last_token_type) =
parse_self_contained_declaration_value(input, Some(&mut references))?; parse_self_contained_declaration_value(input, Some(&mut references))?;
let custom_property_references = references.custom_property_references let custom_property_references = references
.custom_property_references
.into_iter() .into_iter()
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();

View file

@ -325,7 +325,11 @@ impl MediaFeatureExpression {
}; };
let atom = Atom::from(string_as_ascii_lowercase(feature_name)); let atom = Atom::from(string_as_ascii_lowercase(feature_name));
match MEDIA_FEATURES.iter().enumerate().find(|(_, f)| f.name == atom) { match MEDIA_FEATURES
.iter()
.enumerate()
.find(|(_, f)| f.name == atom)
{
Some((i, f)) => Ok((i, f, range)), Some((i, f)) => Ok((i, f, range)),
None => Err(()), None => Err(()),
} }

View file

@ -12,8 +12,8 @@ use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
use crate::values::specified::box_ as specified; use crate::values::specified::box_ as specified;
pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin}; pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin};
pub use crate::values::specified::box_::{Contain, Display, OverflowClipBox};
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
pub use crate::values::specified::box_::{Contain, Display, OverflowClipBox};
pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType}; pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType};
pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange}; pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};

View file

@ -4,6 +4,7 @@
//! Computed values. //! Computed values.
use self::transform::DirectionVector;
use super::animated::ToAnimatedValue; use super::animated::ToAnimatedValue;
use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent; use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth}; use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth};
@ -23,7 +24,6 @@ use crate::Atom;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use crate::Prefix; use crate::Prefix;
use euclid::Size2D; use euclid::Size2D;
use self::transform::DirectionVector;
use std::cell::RefCell; use std::cell::RefCell;
use std::cmp; use std::cmp;
use std::f32; use std::f32;
@ -467,7 +467,10 @@ impl IsParallelTo for (Number, Number, Number) {
// If a and b is parallel, the angle between them is 0deg, so // If a and b is parallel, the angle between them is 0deg, so
// a x b = |a|*|b|*sin(0)*n = 0 * n, |a x b| == 0. // a x b = |a|*|b|*sin(0)*n = 0 * n, |a x b| == 0.
let self_vector = DirectionVector::new(self.0, self.1, self.2); let self_vector = DirectionVector::new(self.0, self.1, self.2);
self_vector.cross(*vector).square_length().approx_eq(&0.0f32) self_vector
.cross(*vector)
.square_length()
.approx_eq(&0.0f32)
} }
} }

View file

@ -14,7 +14,7 @@ use crate::values::generics::basic_shape::{ShapeBox, ShapeSource};
use crate::values::generics::rect::Rect; use crate::values::generics::rect::Rect;
use crate::values::specified::border::BorderRadius; use crate::values::specified::border::BorderRadius;
use crate::values::specified::image::Image; use crate::values::specified::image::Image;
use crate::values::specified::position::{HorizontalPosition, VerticalPosition, Position}; use crate::values::specified::position::{HorizontalPosition, Position, VerticalPosition};
use crate::values::specified::url::SpecifiedUrl; use crate::values::specified::url::SpecifiedUrl;
use crate::values::specified::LengthOrPercentage; use crate::values::specified::LengthOrPercentage;
use crate::values::specified::SVGPathData; use crate::values::specified::SVGPathData;

View file

@ -300,7 +300,10 @@ impl IsParallelTo for (Number, Number, Number) {
// If a and b is parallel, the angle between them is 0deg, so // If a and b is parallel, the angle between them is 0deg, so
// a x b = |a|*|b|*sin(0)*n = 0 * n, |a x b| == 0. // a x b = |a|*|b|*sin(0)*n = 0 * n, |a x b| == 0.
let self_vector = DirectionVector::new(self.0.get(), self.1.get(), self.2.get()); let self_vector = DirectionVector::new(self.0.get(), self.1.get(), self.2.get());
self_vector.cross(*vector).square_length().approx_eq(&0.0f32) self_vector
.cross(*vector)
.square_length()
.approx_eq(&0.0f32)
} }
} }

View file

@ -362,21 +362,24 @@ impl Parse for Rotate {
// The rotate axis and angle could be in any order, so we parse angle twice to cover // The rotate axis and angle could be in any order, so we parse angle twice to cover
// two cases. i.e. `<number>{3} <angle>` or `<angle> <number>{3}` // two cases. i.e. `<number>{3} <angle>` or `<angle> <number>{3}`
let angle = input.try(|i| specified::Angle::parse(context, i)).ok(); let angle = input.try(|i| specified::Angle::parse(context, i)).ok();
let axis = input.try(|i| { let axis = input
Ok(try_match_ident_ignore_ascii_case! { i, .try(|i| {
"x" => (Number::new(1.), Number::new(0.), Number::new(0.)), Ok(try_match_ident_ignore_ascii_case! { i,
"y" => (Number::new(0.), Number::new(1.), Number::new(0.)), "x" => (Number::new(1.), Number::new(0.), Number::new(0.)),
"z" => (Number::new(0.), Number::new(0.), Number::new(1.)), "y" => (Number::new(0.), Number::new(1.), Number::new(0.)),
"z" => (Number::new(0.), Number::new(0.), Number::new(1.)),
})
}) })
}).or_else(|_: ParseError| -> Result<_, ParseError> { .or_else(|_: ParseError| -> Result<_, ParseError> {
input.try(|i| { input.try(|i| {
Ok(( Ok((
Number::parse(context, i)?, Number::parse(context, i)?,
Number::parse(context, i)?, Number::parse(context, i)?,
Number::parse(context, i)?, Number::parse(context, i)?,
)) ))
})
}) })
}).ok(); .ok();
let angle = match angle { let angle = match angle {
Some(a) => a, Some(a) => a,
None => specified::Angle::parse(context, input)?, None => specified::Angle::parse(context, input)?,