servo: Merge #13093 - Remove unneeded clone in the style system cache (from ashrko619:cache-element-classnames); r=nox
authorAshwin R <ashwinravichandran24@gmail.com>
Sun, 28 Aug 2016 05:55:56 -0500
changeset 339595 6ccb382676be113d678f247a1f20c51cbd3689bb
parent 339594 2ebd2bdeb50654ffd40e02be51e82437bcf0866b
child 339596 9fa37a9633e101cb25d1b619eb22ebc933ab94ad
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnox
servo: Merge #13093 - Remove unneeded clone in the style system cache (from ashrko619:cache-element-classnames); r=nox <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13089 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: db52d8a815a02be1f4f7e6270279235cec7005be
servo/components/style/matching.rs
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -383,17 +383,17 @@ fn have_same_class<E: TElement>(element:
     element.each_class(|c| element_class_attributes.push(c.clone()));
 
     if candidate.class_attributes.is_none() {
         let mut attrs = vec![];
         candidate_element.each_class(|c| attrs.push(c.clone()));
         candidate.class_attributes = Some(attrs)
     }
 
-    element_class_attributes == candidate.class_attributes.clone().unwrap()
+    element_class_attributes == *candidate.class_attributes.as_ref().unwrap()
 }
 
 // TODO: These re-match the candidate every time, which is suboptimal.
 #[inline]
 fn match_same_not_common_style_affecting_attributes_rules<E: TElement>(element: &E,
                                                                        candidate: &E,
                                                                        ctx: &SharedStyleContext) -> bool {
     ctx.stylist.match_same_not_common_style_affecting_attributes_rules(element, candidate)