style: Simplify Debug impl for PropertyDeclaration reusing to_css.

These two functions appear in the data from bug 1328497.

I think the way to fix this is another one (either using static arrays to get
the interesting data, or making rust generate the equivalent code).
This commit is contained in:
Emilio Cobos Álvarez 2017-01-04 18:22:24 +01:00
parent 68ecb04847
commit c8ea840106
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -842,17 +842,7 @@ impl fmt::Debug for PropertyDeclaration {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(self.id().to_css(f)); try!(self.id().to_css(f));
try!(f.write_str(": ")); try!(f.write_str(": "));
match *self { self.to_css(f)
% for property in data.longhands:
% if not property.derived_from:
PropertyDeclaration::${property.camel_case}(ref value) => value.to_css(f),
% endif
% endfor
PropertyDeclaration::Custom(_, ref value) => value.to_css(f),
% if any(property.derived_from for property in data.longhands):
_ => Err(fmt::Error),
% endif
}
} }
} }