mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Remove the special-case in single_keyword_computed.
The other case is pretty much the same.
This commit is contained in:
parent
9788ffe3e4
commit
900eaec3cc
1 changed files with 17 additions and 23 deletions
|
@ -500,32 +500,26 @@
|
||||||
|
|
||||||
<%def name="single_keyword(name, values, vector=False, **kwargs)">
|
<%def name="single_keyword(name, values, vector=False, **kwargs)">
|
||||||
<%call expr="single_keyword_computed(name, values, vector, **kwargs)">
|
<%call expr="single_keyword_computed(name, values, vector, **kwargs)">
|
||||||
% if not "extra_specified" in kwargs and ("aliases" in kwargs or (("extra_%s_aliases" % product) in kwargs)):
|
impl ToComputedValue for SpecifiedValue {
|
||||||
impl ToComputedValue for SpecifiedValue {
|
type ComputedValue = computed_value::T;
|
||||||
type ComputedValue = computed_value::T;
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_computed_value(&self, _context: &Context) -> computed_value::T {
|
fn to_computed_value(&self, _context: &Context) -> computed_value::T {
|
||||||
match *self {
|
match *self {
|
||||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||||
SpecifiedValue::${to_rust_ident(value)} => computed_value::T::${to_rust_ident(value)},
|
SpecifiedValue::${to_rust_ident(value)} => computed_value::T::${to_rust_ident(value)},
|
||||||
% endfor
|
% endfor
|
||||||
}
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
fn from_computed_value(computed: &computed_value::T) -> Self {
|
|
||||||
match *computed {
|
|
||||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
|
||||||
computed_value::T::${to_rust_ident(value)} => SpecifiedValue::${to_rust_ident(value)},
|
|
||||||
% endfor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
% else:
|
#[inline]
|
||||||
use values::computed::ComputedValueAsSpecified;
|
fn from_computed_value(computed: &computed_value::T) -> Self {
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
match *computed {
|
||||||
% endif
|
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||||
|
computed_value::T::${to_rust_ident(value)} => SpecifiedValue::${to_rust_ident(value)},
|
||||||
|
% endfor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</%call>
|
</%call>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue