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 && may_collapse_through = may_collapse_through &&
match fragment.style().content_block_size() { match fragment.style().content_block_size() {
LengthOrPercentageOrAuto::Auto => true, LengthOrPercentageOrAuto::Auto => true,
LengthOrPercentageOrAuto::Length(Au(0)) => true, LengthOrPercentageOrAuto::Length(Au(v)) => v == 0,
LengthOrPercentageOrAuto::Percentage(0.) => true, LengthOrPercentageOrAuto::Percentage(v) => {
LengthOrPercentageOrAuto::Percentage(_) if v == 0. || containing_block_size.is_none()
containing_block_size.is_none() => true, }
_ => false, LengthOrPercentageOrAuto::Calc(_) => false,
}; };
if may_collapse_through { if may_collapse_through {
match fragment.style().min_block_size() { 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 FinalMarginState::MarginsCollapseThrough
}, },
_ => { _ => {

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

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

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

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

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

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