mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #7519 - Manishearth:clippyfix, r=SimonSapin
Make style clippy-free (except for properties.rs) I might add more fixes to this PR later. r? @SimonSapin <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7519) <!-- Reviewable:end -->
This commit is contained in:
commit
d01ab61734
5 changed files with 129 additions and 129 deletions
|
@ -798,26 +798,26 @@ fn build_identity_transform_list(list: &Vec<TransformOperation>) -> Vec<Transfor
|
|||
let mut result = vec!();
|
||||
|
||||
for operation in list {
|
||||
match operation {
|
||||
&TransformOperation::Matrix(..) => {
|
||||
match *operation {
|
||||
TransformOperation::Matrix(..) => {
|
||||
let identity = ComputedMatrix::identity();
|
||||
result.push(TransformOperation::Matrix(identity));
|
||||
}
|
||||
&TransformOperation::Skew(..) => {
|
||||
TransformOperation::Skew(..) => {
|
||||
result.push(TransformOperation::Skew(0.0, 0.0));
|
||||
}
|
||||
&TransformOperation::Translate(..) => {
|
||||
TransformOperation::Translate(..) => {
|
||||
result.push(TransformOperation::Translate(LengthOrPercentage::zero(),
|
||||
LengthOrPercentage::zero(),
|
||||
Au(0)));
|
||||
}
|
||||
&TransformOperation::Scale(..) => {
|
||||
TransformOperation::Scale(..) => {
|
||||
result.push(TransformOperation::Scale(1.0, 1.0, 1.0));
|
||||
}
|
||||
&TransformOperation::Rotate(..) => {
|
||||
TransformOperation::Rotate(..) => {
|
||||
result.push(TransformOperation::Rotate(0.0, 0.0, 1.0, Angle(0.0)));
|
||||
}
|
||||
&TransformOperation::Perspective(..) => {
|
||||
TransformOperation::Perspective(..) => {
|
||||
// http://dev.w3.org/csswg/css-transforms/#identity-transform-function
|
||||
let identity = ComputedMatrix::identity();
|
||||
result.push(TransformOperation::Matrix(identity));
|
||||
|
|
|
@ -25,16 +25,16 @@ pub enum Range<T> {
|
|||
|
||||
impl Range<specified::Length> {
|
||||
fn to_computed_range(&self, viewport_size: Size2D<Au>) -> Range<Au> {
|
||||
let compute_width = |width| {
|
||||
let compute_width = |&width| {
|
||||
match width {
|
||||
&specified::Length::Absolute(value) => value,
|
||||
&specified::Length::FontRelative(value) => {
|
||||
specified::Length::Absolute(value) => value,
|
||||
specified::Length::FontRelative(value) => {
|
||||
// http://dev.w3.org/csswg/mediaqueries3/#units
|
||||
// em units are relative to the initial font-size.
|
||||
let initial_font_size = longhands::font_size::get_initial_value();
|
||||
value.to_computed_value(initial_font_size, initial_font_size)
|
||||
}
|
||||
&specified::Length::ViewportPercentage(value) =>
|
||||
specified::Length::ViewportPercentage(value) =>
|
||||
value.to_computed_value(viewport_size),
|
||||
_ => unreachable!()
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ impl Stylesheet {
|
|||
Stylesheet::from_str(&string, base_url, origin)
|
||||
}
|
||||
|
||||
pub fn from_str<'i>(css: &'i str, base_url: Url, origin: Origin) -> Stylesheet {
|
||||
pub fn from_str(css: &str, base_url: Url, origin: Origin) -> Stylesheet {
|
||||
let rule_parser = TopLevelRuleParser {
|
||||
context: ParserContext::new(origin, &base_url),
|
||||
state: Cell::new(State::Start),
|
||||
|
@ -139,7 +139,7 @@ impl Stylesheet {
|
|||
|
||||
/// Return an iterator over all the rules within the style-sheet.
|
||||
#[inline]
|
||||
pub fn rules<'a>(&'a self) -> Rules<'a> {
|
||||
pub fn rules(&self) -> Rules {
|
||||
Rules::new(self.rules.iter(), None)
|
||||
}
|
||||
|
||||
|
@ -243,8 +243,8 @@ pub mod rule_filter {
|
|||
|
||||
fn next(&mut self) -> Option<&'a $value> {
|
||||
while let Some(rule) = self.iter.next() {
|
||||
match rule {
|
||||
&CSSRule::$variant(ref value) => return Some(value),
|
||||
match *rule {
|
||||
CSSRule::$variant(ref value) => return Some(value),
|
||||
_ => continue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ macro_rules! define_css_keyword_enum {
|
|||
impl ::cssparser::ToCss for $name {
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
where W: ::std::fmt::Write {
|
||||
match self {
|
||||
$( &$name::$variant => dest.write_str($css) ),+
|
||||
match *self {
|
||||
$( $name::$variant => dest.write_str($css) ),+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ macro_rules! define_numbered_css_keyword_enum {
|
|||
impl ::cssparser::ToCss for $name {
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
where W: ::std::fmt::Write {
|
||||
match self {
|
||||
$( &$name::$variant => dest.write_str($css) ),+
|
||||
match *self {
|
||||
$( $name::$variant => dest.write_str($css) ),+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,9 +96,9 @@ pub mod specified {
|
|||
impl AllowedNumericType {
|
||||
#[inline]
|
||||
pub fn is_ok(&self, value: f32) -> bool {
|
||||
match self {
|
||||
&AllowedNumericType::All => true,
|
||||
&AllowedNumericType::NonNegative => value >= 0.,
|
||||
match *self {
|
||||
AllowedNumericType::All => true,
|
||||
AllowedNumericType::NonNegative => value >= 0.,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,11 +157,11 @@ pub mod specified {
|
|||
|
||||
impl ToCss for FontRelativeLength {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&FontRelativeLength::Em(length) => write!(dest, "{}em", length),
|
||||
&FontRelativeLength::Ex(length) => write!(dest, "{}ex", length),
|
||||
&FontRelativeLength::Ch(length) => write!(dest, "{}ch", length),
|
||||
&FontRelativeLength::Rem(length) => write!(dest, "{}rem", length)
|
||||
match *self {
|
||||
FontRelativeLength::Em(length) => write!(dest, "{}em", length),
|
||||
FontRelativeLength::Ex(length) => write!(dest, "{}ex", length),
|
||||
FontRelativeLength::Ch(length) => write!(dest, "{}ch", length),
|
||||
FontRelativeLength::Rem(length) => write!(dest, "{}rem", length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,14 +172,14 @@ pub mod specified {
|
|||
root_font_size: Au)
|
||||
-> Au
|
||||
{
|
||||
match self {
|
||||
&FontRelativeLength::Em(length) => reference_font_size.scale_by(length),
|
||||
&FontRelativeLength::Ex(length) | &FontRelativeLength::Ch(length) => {
|
||||
match *self {
|
||||
FontRelativeLength::Em(length) => reference_font_size.scale_by(length),
|
||||
FontRelativeLength::Ex(length) | FontRelativeLength::Ch(length) => {
|
||||
// https://github.com/servo/servo/issues/7462
|
||||
let em_factor = 0.5;
|
||||
reference_font_size.scale_by(length * em_factor)
|
||||
},
|
||||
&FontRelativeLength::Rem(length) => root_font_size.scale_by(length)
|
||||
FontRelativeLength::Rem(length) => root_font_size.scale_by(length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ pub mod specified {
|
|||
|
||||
impl ToCss for ViewportPercentageLength {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&ViewportPercentageLength::Vw(length) => write!(dest, "{}vw", length),
|
||||
&ViewportPercentageLength::Vh(length) => write!(dest, "{}vh", length),
|
||||
&ViewportPercentageLength::Vmin(length) => write!(dest, "{}vmin", length),
|
||||
&ViewportPercentageLength::Vmax(length) => write!(dest, "{}vmax", length)
|
||||
match *self {
|
||||
ViewportPercentageLength::Vw(length) => write!(dest, "{}vw", length),
|
||||
ViewportPercentageLength::Vh(length) => write!(dest, "{}vh", length),
|
||||
ViewportPercentageLength::Vmin(length) => write!(dest, "{}vmin", length),
|
||||
ViewportPercentageLength::Vmax(length) => write!(dest, "{}vmax", length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,14 +211,14 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
|
||||
let value = match self {
|
||||
&ViewportPercentageLength::Vw(length) =>
|
||||
let value = match *self {
|
||||
ViewportPercentageLength::Vw(length) =>
|
||||
length * to_unit!(viewport_size.width),
|
||||
&ViewportPercentageLength::Vh(length) =>
|
||||
ViewportPercentageLength::Vh(length) =>
|
||||
length * to_unit!(viewport_size.height),
|
||||
&ViewportPercentageLength::Vmin(length) =>
|
||||
ViewportPercentageLength::Vmin(length) =>
|
||||
length * to_unit!(cmp::min(viewport_size.width, viewport_size.height)),
|
||||
&ViewportPercentageLength::Vmax(length) =>
|
||||
ViewportPercentageLength::Vmax(length) =>
|
||||
length * to_unit!(cmp::max(viewport_size.width, viewport_size.height)),
|
||||
};
|
||||
Au::from_f32_px(value)
|
||||
|
@ -255,11 +255,11 @@ pub mod specified {
|
|||
|
||||
impl ToCss for Length {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&Length::Absolute(length) => write!(dest, "{}px", length.to_f32_px()),
|
||||
&Length::FontRelative(length) => length.to_css(dest),
|
||||
&Length::ViewportPercentage(length) => length.to_css(dest),
|
||||
&Length::ServoCharacterWidth(_)
|
||||
match *self {
|
||||
Length::Absolute(length) => write!(dest, "{}px", length.to_f32_px()),
|
||||
Length::FontRelative(length) => length.to_css(dest),
|
||||
Length::ViewportPercentage(length) => length.to_css(dest),
|
||||
Length::ServoCharacterWidth(_)
|
||||
=> panic!("internal CSS values should never be serialized"),
|
||||
}
|
||||
}
|
||||
|
@ -403,11 +403,11 @@ pub mod specified {
|
|||
|
||||
#[inline]
|
||||
fn mul(self, scalar: CSSFloat) -> SimplifiedValueNode {
|
||||
match self {
|
||||
&SimplifiedValueNode::Length(l) => SimplifiedValueNode::Length(l * scalar),
|
||||
&SimplifiedValueNode::Percentage(p) => SimplifiedValueNode::Percentage(p * scalar),
|
||||
&SimplifiedValueNode::Number(n) => SimplifiedValueNode::Number(n * scalar),
|
||||
&SimplifiedValueNode::Sum(box ref s) => {
|
||||
match *self {
|
||||
SimplifiedValueNode::Length(l) => SimplifiedValueNode::Length(l * scalar),
|
||||
SimplifiedValueNode::Percentage(p) => SimplifiedValueNode::Percentage(p * scalar),
|
||||
SimplifiedValueNode::Number(n) => SimplifiedValueNode::Number(n * scalar),
|
||||
SimplifiedValueNode::Sum(box ref s) => {
|
||||
let sum = s * scalar;
|
||||
SimplifiedValueNode::Sum(box sum)
|
||||
}
|
||||
|
@ -497,9 +497,9 @@ pub mod specified {
|
|||
}
|
||||
|
||||
fn simplify_value_to_number(node: &CalcValueNode) -> Option<CSSFloat> {
|
||||
match node {
|
||||
&CalcValueNode::Number(number) => Some(number),
|
||||
&CalcValueNode::Sum(box ref sum) => Calc::simplify_sum_to_number(sum),
|
||||
match *node {
|
||||
CalcValueNode::Number(number) => Some(number),
|
||||
CalcValueNode::Sum(box ref sum) => Calc::simplify_sum_to_number(sum),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
@ -549,11 +549,11 @@ pub mod specified {
|
|||
match Calc::simplify_value_to_number(&node) {
|
||||
Some(number) => multiplier *= number,
|
||||
_ if node_with_unit.is_none() => {
|
||||
node_with_unit = Some(match node {
|
||||
&CalcValueNode::Sum(box ref sum) =>
|
||||
node_with_unit = Some(match *node {
|
||||
CalcValueNode::Sum(box ref sum) =>
|
||||
try!(Calc::simplify_products_in_sum(sum)),
|
||||
&CalcValueNode::Length(l) => SimplifiedValueNode::Length(l),
|
||||
&CalcValueNode::Percentage(p) => SimplifiedValueNode::Percentage(p),
|
||||
CalcValueNode::Length(l) => SimplifiedValueNode::Length(l),
|
||||
CalcValueNode::Percentage(p) => SimplifiedValueNode::Percentage(p),
|
||||
_ => unreachable!("Numbers should have been handled by simplify_value_to_nubmer")
|
||||
})
|
||||
},
|
||||
|
@ -707,10 +707,10 @@ pub mod specified {
|
|||
|
||||
impl ToCss for LengthOrPercentage {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrPercentage::Length(length) => length.to_css(dest),
|
||||
&LengthOrPercentage::Percentage(percentage) => percentage.to_css(dest),
|
||||
&LengthOrPercentage::Calc(calc) => calc.to_css(dest),
|
||||
match *self {
|
||||
LengthOrPercentage::Length(length) => length.to_css(dest),
|
||||
LengthOrPercentage::Percentage(percentage) => percentage.to_css(dest),
|
||||
LengthOrPercentage::Calc(calc) => calc.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -757,11 +757,11 @@ pub mod specified {
|
|||
|
||||
impl ToCss for LengthOrPercentageOrAuto {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrPercentageOrAuto::Length(length) => length.to_css(dest),
|
||||
&LengthOrPercentageOrAuto::Percentage(percentage) => percentage.to_css(dest),
|
||||
&LengthOrPercentageOrAuto::Auto => dest.write_str("auto"),
|
||||
&LengthOrPercentageOrAuto::Calc(calc) => calc.to_css(dest),
|
||||
match *self {
|
||||
LengthOrPercentageOrAuto::Length(length) => length.to_css(dest),
|
||||
LengthOrPercentageOrAuto::Percentage(percentage) => percentage.to_css(dest),
|
||||
LengthOrPercentageOrAuto::Auto => dest.write_str("auto"),
|
||||
LengthOrPercentageOrAuto::Calc(calc) => calc.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -805,10 +805,10 @@ pub mod specified {
|
|||
|
||||
impl ToCss for LengthOrPercentageOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrPercentageOrNone::Length(length) => length.to_css(dest),
|
||||
&LengthOrPercentageOrNone::Percentage(percentage) => percentage.to_css(dest),
|
||||
&LengthOrPercentageOrNone::None => dest.write_str("none"),
|
||||
match *self {
|
||||
LengthOrPercentageOrNone::Length(length) => length.to_css(dest),
|
||||
LengthOrPercentageOrNone::Percentage(percentage) => percentage.to_css(dest),
|
||||
LengthOrPercentageOrNone::None => dest.write_str("none"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -847,9 +847,9 @@ pub mod specified {
|
|||
|
||||
impl ToCss for LengthOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrNone::Length(length) => length.to_css(dest),
|
||||
&LengthOrNone::None => dest.write_str("none"),
|
||||
match *self {
|
||||
LengthOrNone::Length(length) => length.to_css(dest),
|
||||
LengthOrNone::None => dest.write_str("none"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -978,14 +978,14 @@ pub mod specified {
|
|||
|
||||
impl ToCss for Image {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&Image::Url(ref url) => {
|
||||
match *self {
|
||||
Image::Url(ref url) => {
|
||||
try!(dest.write_str("url(\""));
|
||||
try!(write!(&mut CssStringWriter::new(dest), "{}", url));
|
||||
try!(dest.write_str("\")"));
|
||||
Ok(())
|
||||
}
|
||||
&Image::LinearGradient(ref gradient) => gradient.to_css(dest)
|
||||
Image::LinearGradient(ref gradient) => gradient.to_css(dest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1042,9 +1042,9 @@ pub mod specified {
|
|||
|
||||
impl ToCss for AngleOrCorner {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&AngleOrCorner::Angle(angle) => angle.to_css(dest),
|
||||
&AngleOrCorner::Corner(horizontal, vertical) => {
|
||||
match *self {
|
||||
AngleOrCorner::Angle(angle) => angle.to_css(dest),
|
||||
AngleOrCorner::Corner(horizontal, vertical) => {
|
||||
try!(dest.write_str("to "));
|
||||
try!(horizontal.to_css(dest));
|
||||
try!(dest.write_str(" "));
|
||||
|
@ -1279,13 +1279,13 @@ pub mod computed {
|
|||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> Au {
|
||||
match self {
|
||||
&specified::Length::Absolute(length) => length,
|
||||
&specified::Length::FontRelative(length) =>
|
||||
match *self {
|
||||
specified::Length::Absolute(length) => length,
|
||||
specified::Length::FontRelative(length) =>
|
||||
length.to_computed_value(context.font_size, context.root_font_size),
|
||||
&specified::Length::ViewportPercentage(length) =>
|
||||
specified::Length::ViewportPercentage(length) =>
|
||||
length.to_computed_value(context.viewport_size),
|
||||
&specified::Length::ServoCharacterWidth(length) =>
|
||||
specified::Length::ServoCharacterWidth(length) =>
|
||||
length.to_computed_value(context.font_size)
|
||||
}
|
||||
}
|
||||
|
@ -1361,10 +1361,10 @@ pub mod computed {
|
|||
|
||||
impl fmt::Debug for LengthOrPercentage {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
&LengthOrPercentage::Length(length) => write!(f, "{:?}", length),
|
||||
&LengthOrPercentage::Percentage(percentage) => write!(f, "{}%", percentage * 100.),
|
||||
&LengthOrPercentage::Calc(calc) => write!(f, "{:?}", calc),
|
||||
match *self {
|
||||
LengthOrPercentage::Length(length) => write!(f, "{:?}", length),
|
||||
LengthOrPercentage::Percentage(percentage) => write!(f, "{}%", percentage * 100.),
|
||||
LengthOrPercentage::Calc(calc) => write!(f, "{:?}", calc),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1389,11 +1389,11 @@ pub mod computed {
|
|||
|
||||
impl ::cssparser::ToCss for LengthOrPercentage {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrPercentage::Length(length) => length.to_css(dest),
|
||||
&LengthOrPercentage::Percentage(percentage)
|
||||
match *self {
|
||||
LengthOrPercentage::Length(length) => length.to_css(dest),
|
||||
LengthOrPercentage::Percentage(percentage)
|
||||
=> write!(dest, "{}%", percentage * 100.),
|
||||
&LengthOrPercentage::Calc(calc) => calc.to_css(dest),
|
||||
LengthOrPercentage::Calc(calc) => calc.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1407,11 +1407,11 @@ pub mod computed {
|
|||
}
|
||||
impl fmt::Debug for LengthOrPercentageOrAuto {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
&LengthOrPercentageOrAuto::Length(length) => write!(f, "{:?}", length),
|
||||
&LengthOrPercentageOrAuto::Percentage(percentage) => write!(f, "{}%", percentage * 100.),
|
||||
&LengthOrPercentageOrAuto::Auto => write!(f, "auto"),
|
||||
&LengthOrPercentageOrAuto::Calc(calc) => write!(f, "{:?}", calc),
|
||||
match *self {
|
||||
LengthOrPercentageOrAuto::Length(length) => write!(f, "{:?}", length),
|
||||
LengthOrPercentageOrAuto::Percentage(percentage) => write!(f, "{}%", percentage * 100.),
|
||||
LengthOrPercentageOrAuto::Auto => write!(f, "auto"),
|
||||
LengthOrPercentageOrAuto::Calc(calc) => write!(f, "{:?}", calc),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1440,12 +1440,12 @@ pub mod computed {
|
|||
|
||||
impl ::cssparser::ToCss for LengthOrPercentageOrAuto {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrPercentageOrAuto::Length(length) => length.to_css(dest),
|
||||
&LengthOrPercentageOrAuto::Percentage(percentage)
|
||||
match *self {
|
||||
LengthOrPercentageOrAuto::Length(length) => length.to_css(dest),
|
||||
LengthOrPercentageOrAuto::Percentage(percentage)
|
||||
=> write!(dest, "{}%", percentage * 100.),
|
||||
&LengthOrPercentageOrAuto::Auto => dest.write_str("auto"),
|
||||
&LengthOrPercentageOrAuto::Calc(calc) => calc.to_css(dest),
|
||||
LengthOrPercentageOrAuto::Auto => dest.write_str("auto"),
|
||||
LengthOrPercentageOrAuto::Calc(calc) => calc.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1458,10 +1458,10 @@ pub mod computed {
|
|||
}
|
||||
impl fmt::Debug for LengthOrPercentageOrNone {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
&LengthOrPercentageOrNone::Length(length) => write!(f, "{:?}", length),
|
||||
&LengthOrPercentageOrNone::Percentage(percentage) => write!(f, "{}%", percentage * 100.),
|
||||
&LengthOrPercentageOrNone::None => write!(f, "none"),
|
||||
match *self {
|
||||
LengthOrPercentageOrNone::Length(length) => write!(f, "{:?}", length),
|
||||
LengthOrPercentageOrNone::Percentage(percentage) => write!(f, "{}%", percentage * 100.),
|
||||
LengthOrPercentageOrNone::None => write!(f, "none"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1487,11 +1487,11 @@ pub mod computed {
|
|||
|
||||
impl ::cssparser::ToCss for LengthOrPercentageOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrPercentageOrNone::Length(length) => length.to_css(dest),
|
||||
&LengthOrPercentageOrNone::Percentage(percentage) =>
|
||||
match *self {
|
||||
LengthOrPercentageOrNone::Length(length) => length.to_css(dest),
|
||||
LengthOrPercentageOrNone::Percentage(percentage) =>
|
||||
write!(dest, "{}%", percentage * 100.),
|
||||
&LengthOrPercentageOrNone::None => dest.write_str("none"),
|
||||
LengthOrPercentageOrNone::None => dest.write_str("none"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1503,9 +1503,9 @@ pub mod computed {
|
|||
}
|
||||
impl fmt::Debug for LengthOrNone {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
&LengthOrNone::Length(length) => write!(f, "{:?}", length),
|
||||
&LengthOrNone::None => write!(f, "none"),
|
||||
match *self {
|
||||
LengthOrNone::Length(length) => write!(f, "{:?}", length),
|
||||
LengthOrNone::None => write!(f, "none"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1528,9 +1528,9 @@ pub mod computed {
|
|||
|
||||
impl ::cssparser::ToCss for LengthOrNone {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self {
|
||||
&LengthOrNone::Length(length) => length.to_css(dest),
|
||||
&LengthOrNone::None => dest.write_str("none"),
|
||||
match *self {
|
||||
LengthOrNone::Length(length) => length.to_css(dest),
|
||||
LengthOrNone::None => dest.write_str("none"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1559,9 +1559,9 @@ pub mod computed {
|
|||
|
||||
impl fmt::Debug for Image {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
&Image::Url(ref url) => write!(f, "url(\"{}\")", url),
|
||||
&Image::LinearGradient(ref grad) => write!(f, "linear-gradient({:?})", grad),
|
||||
match *self {
|
||||
Image::Url(ref url) => write!(f, "url(\"{}\")", url),
|
||||
Image::LinearGradient(ref grad) => write!(f, "linear-gradient({:?})", grad),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,10 +46,10 @@ impl ToCss for Zoom {
|
|||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write
|
||||
{
|
||||
match self {
|
||||
&Zoom::Number(number) => write!(dest, "{}", number),
|
||||
&Zoom::Percentage(percentage) => write!(dest, "{}%", percentage * 100.),
|
||||
&Zoom::Auto => write!(dest, "auto")
|
||||
match *self {
|
||||
Zoom::Number(number) => write!(dest, "{}", number),
|
||||
Zoom::Percentage(percentage) => write!(dest, "{}%", percentage * 100.),
|
||||
Zoom::Auto => write!(dest, "auto")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,10 +71,10 @@ impl Zoom {
|
|||
|
||||
#[inline]
|
||||
pub fn to_f32(&self) -> Option<f32> {
|
||||
match self {
|
||||
&Zoom::Number(number) => Some(number as f32),
|
||||
&Zoom::Percentage(percentage) => Some(percentage as f32),
|
||||
&Zoom::Auto => None
|
||||
match *self {
|
||||
Zoom::Number(number) => Some(number as f32),
|
||||
Zoom::Percentage(percentage) => Some(percentage as f32),
|
||||
Zoom::Auto => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ pub struct ViewportRule {
|
|||
}
|
||||
|
||||
impl ViewportRule {
|
||||
pub fn parse<'a>(input: &mut Parser, context: &'a ParserContext)
|
||||
pub fn parse(input: &mut Parser, context: &ParserContext)
|
||||
-> Result<ViewportRule, ()>
|
||||
{
|
||||
let parser = ViewportRuleParser { context: context };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue