diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-08-20 13:35:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-20 13:35:04 -0500 |
commit | 8a75810eba22a76b78ca2ef4db64f946013f780f (patch) | |
tree | 01b7d2135d657071e31d59502596692fe9481d12 /components/script | |
parent | ef2ee4646fedc45e37fdf16658a70c849744ed32 (diff) | |
parent | 1637b0ba8a66839e3329a3cf552ab2d4fb3c67c6 (diff) | |
download | servo-8a75810eba22a76b78ca2ef4db64f946013f780f.tar.gz servo-8a75810eba22a76b78ca2ef4db64f946013f780f.zip |
Auto merge of #12861 - nox:impl-trait, r=Ms2ger
Clean up some iterators
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12861)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/cssstyledeclaration.rs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 101ac3ef252..1ab80ebf19a 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -14,12 +14,11 @@ use dom::element::{Element, StylePriority}; use dom::node::{Node, NodeDamage, window_from_node}; use dom::window::Window; use std::ascii::AsciiExt; -use std::cell::Ref; -use std::slice; +use std::ops::Deref; use string_cache::Atom; use style::parser::ParserContextExtraData; -use style::properties::{PropertyDeclaration, Shorthand}; -use style::properties::{is_supported_property, parse_one_declaration, parse_style_attribute}; +use style::properties::{Shorthand, is_supported_property}; +use style::properties::{parse_one_declaration, parse_style_attribute}; use style::selector_impl::PseudoElement; // http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface @@ -148,19 +147,9 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { } } - // Step 2.3 - // Work around closures not being Clone - #[derive(Clone)] - struct Map<'a, 'b: 'a>(slice::Iter<'a, Ref<'b, PropertyDeclaration>>); - impl<'a, 'b> Iterator for Map<'a, 'b> { - type Item = &'a PropertyDeclaration; - fn next(&mut self) -> Option<Self::Item> { - self.0.next().map(|r| &**r) - } - } - // TODO: important is hardcoded to false because method does not implement it yet - let serialized_value = shorthand.serialize_shorthand_value_to_string(Map(list.iter()), false); + let serialized_value = shorthand.serialize_shorthand_value_to_string( + list.iter().map(Deref::deref as fn(_) -> _), false); return DOMString::from(serialized_value); } |