Skip to content

Commit

Permalink
style: Use function pointer rather than Fn trait object for collect_p…
Browse files Browse the repository at this point in the history
…roperty_completion_keywords.

Differential Revision: https://phabricator.services.mozilla.com/D2985
  • Loading branch information
upsuper authored and emilio committed Aug 18, 2018
1 parent c77ecd6 commit f14a3ed
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/style/properties/properties.mako.rs
Expand Up @@ -603,16 +603,17 @@ impl NonCustomPropertyId {

/// See PropertyId::collect_property_completion_keywords.
fn collect_property_completion_keywords(&self, f: KeywordsCollectFn) {
const COLLECT_FUNCTIONS: [&Fn(KeywordsCollectFn);
fn do_nothing(_: KeywordsCollectFn) {}
const COLLECT_FUNCTIONS: [fn(KeywordsCollectFn);
${len(data.longhands) + len(data.shorthands)}] = [
% for prop in data.longhands:
&<${prop.specified_type()} as SpecifiedValueInfo>::collect_completion_keywords,
<${prop.specified_type()} as SpecifiedValueInfo>::collect_completion_keywords,
% endfor
% for prop in data.shorthands:
% if prop.name == "all":
&|_f| {}, // 'all' accepts no value other than CSS-wide keywords
do_nothing, // 'all' accepts no value other than CSS-wide keywords
% else:
&<shorthands::${prop.ident}::Longhands as SpecifiedValueInfo>::
<shorthands::${prop.ident}::Longhands as SpecifiedValueInfo>::
collect_completion_keywords,
% endif
% endfor
Expand Down

0 comments on commit f14a3ed

Please sign in to comment.