From a4c7728062972a804bdb2e3c1f730a7ac624540a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 20 Feb 2018 15:36:43 +0100 Subject: [PATCH] style: Cleanup PrioritizedPropertyIter. --- ports/geckolib/glue.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 18bb3827031..332193c1817 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -3797,24 +3797,23 @@ struct PropertyAndIndex { } struct PrioritizedPropertyIter<'a> { - properties: &'a nsTArray, + properties: &'a [PropertyValuePair], sorted_property_indices: Vec, curr: usize, } impl<'a> PrioritizedPropertyIter<'a> { - pub fn new(properties: &'a nsTArray) -> PrioritizedPropertyIter { - // If we fail to convert a nsCSSPropertyID into a PropertyId we shouldn't fail outright - // but instead by treating that property as the 'all' property we make it sort last. - let all = PropertyId::Shorthand(ShorthandId::All); - + fn new(properties: &'a [PropertyValuePair]) -> PrioritizedPropertyIter { + // If we fail to convert a nsCSSPropertyID into a PropertyId we + // shouldn't fail outright but instead by treating that property as the + // 'all' property we make it sort last. let mut sorted_property_indices: Vec = properties.iter().enumerate().map(|(index, pair)| { - PropertyAndIndex { - property: PropertyId::from_nscsspropertyid(pair.mProperty) - .unwrap_or(all.clone()), - index, - } + let property = + PropertyId::from_nscsspropertyid(pair.mProperty) + .unwrap_or(PropertyId::Shorthand(ShorthandId::All)); + + PropertyAndIndex { property, index } }).collect(); sorted_property_indices.sort_by(|a, b| compare_property_priority(&a.property, &b.property));