diff options
author | S Pradeep Kumar <gohanpra@gmail.com> | 2013-11-25 12:08:41 +0900 |
---|---|---|
committer | S Pradeep Kumar <gohanpra@gmail.com> | 2013-11-25 12:08:41 +0900 |
commit | 318a1a380fdb7c91502a80e74679962bc4ab0bfd (patch) | |
tree | 20b2395e83cbf9863d2b5f0d0cb23feb184f849d /src | |
parent | f6646e17bfc0c91a4e9710d131082f178e7fe1cf (diff) | |
download | servo-318a1a380fdb7c91502a80e74679962bc4ab0bfd.tar.gz servo-318a1a380fdb7c91502a80e74679962bc4ab0bfd.zip |
Use iter().map() instead of for loop.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/style/selector_matching.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/components/style/selector_matching.rs b/src/components/style/selector_matching.rs index 46252bb1643..db6afabccb2 100644 --- a/src/components/style/selector_matching.rs +++ b/src/components/style/selector_matching.rs @@ -293,7 +293,6 @@ impl Stylist { &self.user_rule_map.important, &self.ua_rule_map.important]; - // TODO: Make this a stack-allocated vector let mut matching_rules_list: [~[Rule], ..6] = [~[], ~[], ~[], ~[], ~[], ~[]]; for (i, rule_map) in rule_map_list.iter().enumerate() { rule_map.get_all_matching_rules(element, pseudo_element, matching_rules_list, i); @@ -301,14 +300,8 @@ impl Stylist { // Keeping this as a separate step because we will need it for further // optimizations regarding grouping of Rules having the same Selector. - let mut declarations_list = ~[]; - for rules in matching_rules_list.iter() { - let mut curr_declarations = ~[]; - for rule in rules.iter() { - curr_declarations.push(rule.declarations.clone()); - } - declarations_list.push(curr_declarations); - } + let declarations_list: ~[~[Arc<~[PropertyDeclaration]>]] = matching_rules_list.iter().map( + |rules| rules.iter().map(|r| r.declarations.clone()).collect()).collect(); let mut applicable_declarations = ~[]; applicable_declarations.push_all_move(declarations_list.slice(0, 3).concat_vec()); |