Auto merge of #20073 - servo:keywordsize, r=emilio

Remove some useless manual layout optimisation for KeywordSize

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20073)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-02-19 07:02:45 -05:00 committed by GitHub
commit be902d56c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -197,13 +197,11 @@ where
} }
/// CSS font keywords /// CSS font keywords
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedValue, ToAnimatedZero)] #[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(PartialEq, ToAnimatedValue, ToAnimatedZero)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum KeywordSize { pub enum KeywordSize {
XXSmall = 1, // This is to enable the NonZero optimization XXSmall,
// which simplifies the representation of Option<KeywordSize>
// in bindgen
XSmall, XSmall,
Small, Small,
Medium, Medium,
@ -217,17 +215,9 @@ pub enum KeywordSize {
impl KeywordSize { impl KeywordSize {
/// Convert to an HTML <font size> value /// Convert to an HTML <font size> value
pub fn html_size(&self) -> u8 { #[inline]
match *self { pub fn html_size(self) -> u8 {
KeywordSize::XXSmall => 0, self as u8
KeywordSize::XSmall => 1,
KeywordSize::Small => 2,
KeywordSize::Medium => 3,
KeywordSize::Large => 4,
KeywordSize::XLarge => 5,
KeywordSize::XXLarge => 6,
KeywordSize::XXXLarge => 7,
}
} }
} }