style: Use derive(Parse) for X and Y.

This commit is contained in:
Emilio Cobos Álvarez 2017-12-15 20:10:17 +01:00
parent 4abd1dc819
commit 8fbdbc8f95
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -42,17 +42,21 @@ pub enum PositionComponent<S> {
Side(S, Option<LengthOrPercentage>),
}
define_css_keyword_enum! { X:
"left" => Left,
"right" => Right,
/// A keyword for the X direction.
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[allow(missing_docs)]
pub enum X {
Left,
Right,
}
add_impls_for_keyword_enum!(X);
define_css_keyword_enum! { Y:
"top" => Top,
"bottom" => Bottom,
/// A keyword for the Y direction.
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[allow(missing_docs)]
pub enum Y {
Top,
Bottom,
}
add_impls_for_keyword_enum!(Y);
impl Parse for Position {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {