Auto merge of #17209 - servo:derive-all-the-things, r=emilio

Introduce more generics and more deriving

<!-- 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/17209)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-07 08:55:08 -07:00 committed by GitHub
commit 738483742c
20 changed files with 153 additions and 323 deletions

View file

@ -450,8 +450,8 @@ impl PropertyDeclarationIdSet {
% endfor
/// An enum to represent a CSS Wide keyword.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Copy, Clone, Debug, Eq, PartialEq, ToCss)]
pub enum CSSWideKeyword {
/// The `initial` keyword.
Initial,
@ -483,12 +483,6 @@ impl CSSWideKeyword {
}
}
impl ToCss for CSSWideKeyword {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
dest.write_str(self.to_str())
}
}
impl Parse for CSSWideKeyword {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
let ident = input.expect_ident()?;
@ -628,8 +622,8 @@ impl LonghandId {
}
/// An identifier for a given shorthand property.
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
pub enum ShorthandId {
% for property in data.shorthands:
/// ${property.name}
@ -637,14 +631,6 @@ pub enum ShorthandId {
% endfor
}
impl ToCss for ShorthandId {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,
{
dest.write_str(self.name())
}
}
impl ShorthandId {
/// Get the name for this shorthand property.
pub fn name(&self) -> &'static str {