servo: Merge #16837 - Fix future illegal_floating_point_literal_pattern warnings (from servo:illegal_floating_point_literal_pattern); r=emilio

They make component/style fail to build, because of `#[deny(warnings)]`

Source-Repo: https://github.com/servo/servo
Source-Revision: b6f5d65bbddc9e8d35016c8669256a8a539b7516

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 626223612f9972e075e3fe92bcb78f220beaff7f
This commit is contained in:
Simon Sapin 2017-05-12 22:34:09 -05:00
Родитель c3ef7be747
Коммит e1a25706be
4 изменённых файлов: 23 добавлений и 19 удалений

Просмотреть файл

@ -143,16 +143,19 @@ impl MarginCollapseInfo {
may_collapse_through = may_collapse_through &&
match fragment.style().content_block_size() {
LengthOrPercentageOrAuto::Auto => true,
LengthOrPercentageOrAuto::Length(Au(0)) => true,
LengthOrPercentageOrAuto::Percentage(0.) => true,
LengthOrPercentageOrAuto::Percentage(_) if
containing_block_size.is_none() => true,
_ => false,
LengthOrPercentageOrAuto::Length(Au(v)) => v == 0,
LengthOrPercentageOrAuto::Percentage(v) => {
v == 0. || containing_block_size.is_none()
}
LengthOrPercentageOrAuto::Calc(_) => false,
};
if may_collapse_through {
match fragment.style().min_block_size() {
LengthOrPercentage::Length(Au(0)) | LengthOrPercentage::Percentage(0.) => {
LengthOrPercentage::Length(Au(0)) => {
FinalMarginState::MarginsCollapseThrough
},
LengthOrPercentage::Percentage(v) if v == 0. => {
FinalMarginState::MarginsCollapseThrough
},
_ => {

Просмотреть файл

@ -375,7 +375,7 @@ impl ::std::ops::Deref for AttrValue {
pub fn parse_nonzero_length(value: &str) -> LengthOrPercentageOrAuto {
match parse_length(value) {
LengthOrPercentageOrAuto::Length(x) if x == Au::zero() => LengthOrPercentageOrAuto::Auto,
LengthOrPercentageOrAuto::Percentage(0.) => LengthOrPercentageOrAuto::Auto,
LengthOrPercentageOrAuto::Percentage(x) if x == 0. => LengthOrPercentageOrAuto::Auto,
x => x,
}
}

Просмотреть файл

@ -221,8 +221,9 @@ impl LengthOrPercentage {
pub fn is_definitely_zero(&self) -> bool {
use self::LengthOrPercentage::*;
match *self {
Length(Au(0)) | Percentage(0.0) => true,
Length(_) | Percentage(_) | Calc(_) => false
Length(Au(0)) => true,
Percentage(p) => p == 0.0,
Length(_) | Calc(_) => false
}
}
@ -312,8 +313,9 @@ impl LengthOrPercentageOrAuto {
pub fn is_definitely_zero(&self) -> bool {
use self::LengthOrPercentageOrAuto::*;
match *self {
Length(Au(0)) | Percentage(0.0) => true,
Length(_) | Percentage(_) | Calc(_) | Auto => false
Length(Au(0)) => true,
Percentage(p) => p == 0.0,
Length(_) | Calc(_) | Auto => false
}
}
}

Просмотреть файл

@ -266,14 +266,13 @@ pub enum AbsoluteLength {
impl AbsoluteLength {
fn is_zero(&self) -> bool {
match *self {
AbsoluteLength::Px(0.)
| AbsoluteLength::In(0.)
| AbsoluteLength::Cm(0.)
| AbsoluteLength::Mm(0.)
| AbsoluteLength::Q(0.)
| AbsoluteLength::Pt(0.)
| AbsoluteLength::Pc(0.) => true,
_ => false,
AbsoluteLength::Px(v)
| AbsoluteLength::In(v)
| AbsoluteLength::Cm(v)
| AbsoluteLength::Mm(v)
| AbsoluteLength::Q(v)
| AbsoluteLength::Pt(v)
| AbsoluteLength::Pc(v) => v == 0.,
}
}
}