diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2016-07-12 17:01:36 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-07-12 20:00:24 +0530 |
commit | 2091981db863088688d0c054618b2850ae4aae81 (patch) | |
tree | c795c3656abe1d67a99706686247d2fd5d166ef8 | |
parent | 3ead9cc67b3955b771337e0017b88d367447ed65 (diff) | |
download | servo-2091981db863088688d0c054618b2850ae4aae81.tar.gz servo-2091981db863088688d0c054618b2850ae4aae81.zip |
Some fixes in style
-rw-r--r-- | components/style/attr.rs | 2 | ||||
-rw-r--r-- | components/style/custom_properties.rs | 2 | ||||
-rw-r--r-- | components/style/matching.rs | 19 |
3 files changed, 10 insertions, 13 deletions
diff --git a/components/style/attr.rs b/components/style/attr.rs index 409f6bdbd56..6ca278d7d2c 100644 --- a/components/style/attr.rs +++ b/components/style/attr.rs @@ -490,7 +490,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto { } // Step 5 - if value.starts_with("+") { + if value.starts_with('+') { value = &value[1..] } diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index db7316fa0c0..5a7109f77ac 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -194,7 +194,7 @@ fn parse_declaration_value_block(input: &mut Parser, let token_slice = input.slice_from(token_start); if !token_slice.ends_with("*/") { missing_closing_characters.push_str( - if token_slice.ends_with("*") { "/" } else { "*/" }) + if token_slice.ends_with('*') { "/" } else { "*/" }) } token.serialization_type() } diff --git a/components/style/matching.rs b/components/style/matching.rs index 251d46d70b6..194e58907fb 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -602,17 +602,14 @@ pub trait ElementMatchMethods : TElement } for (i, &(ref candidate, ())) in style_sharing_candidate_cache.iter().enumerate() { - match self.share_style_with_candidate_if_possible(parent.clone(), candidate) { - Some(shared_style) => { - // Yay, cache hit. Share the style. - let node = self.as_node(); - let style = &mut node.mutate_data().unwrap().style; - let damage = <<Self as TElement>::ConcreteNode as TNode> - ::ConcreteRestyleDamage::compute((*style).as_ref(), &*shared_style); - *style = Some(shared_style); - return StyleSharingResult::StyleWasShared(i, damage) - } - None => {} + if let Some(shared_style) = self.share_style_with_candidate_if_possible(parent.clone(), candidate) { + // Yay, cache hit. Share the style. + let node = self.as_node(); + let style = &mut node.mutate_data().unwrap().style; + let damage = <<Self as TElement>::ConcreteNode as TNode> + ::ConcreteRestyleDamage::compute((*style).as_ref(), &*shared_style); + *style = Some(shared_style); + return StyleSharingResult::StyleWasShared(i, damage) } } |