From c072f3ab18ab7fd13cd8da23ce8e1eba05ba103b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Sat, 6 May 2017 21:33:34 +0300 Subject: [PATCH] Clean up text-shadow property --- .../longhand/inherited_text.mako.rs | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index e8870ad3386..644c9979ac1 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -726,7 +726,7 @@ ${helpers.single_keyword("text-align-last", impl HasViewportPercentage for SpecifiedValue { fn has_viewport_percentage(&self) -> bool { let &SpecifiedValue(ref vec) = self; - vec.iter().any(|ref x| x .has_viewport_percentage()) + vec.iter().any(|ref x| x.has_viewport_percentage()) } } @@ -784,15 +784,13 @@ ${helpers.single_keyword("text-align-last", impl ToCss for computed_value::T { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut iter = self.0.iter(); - if let Some(shadow) = iter.next() { - try!(shadow.to_css(dest)); - } else { - try!(dest.write_str("none")); - return Ok(()) + match iter.next() { + Some(shadow) => shadow.to_css(dest)?, + None => return dest.write_str("none"), } for shadow in iter { - try!(dest.write_str(", ")); - try!(shadow.to_css(dest)); + dest.write_str(", ")?; + shadow.to_css(dest)?; } Ok(()) } @@ -800,29 +798,26 @@ ${helpers.single_keyword("text-align-last", impl ToCss for computed_value::TextShadow { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - try!(self.offset_x.to_css(dest)); - try!(dest.write_str(" ")); - try!(self.offset_y.to_css(dest)); - try!(dest.write_str(" ")); - try!(self.blur_radius.to_css(dest)); - try!(dest.write_str(" ")); - try!(self.color.to_css(dest)); - Ok(()) + self.offset_x.to_css(dest)?; + dest.write_str(" ")?; + self.offset_y.to_css(dest)?; + dest.write_str(" ")?; + self.blur_radius.to_css(dest)?; + dest.write_str(" ")?; + self.color.to_css(dest) } } impl ToCss for SpecifiedValue { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut iter = self.0.iter(); - if let Some(shadow) = iter.next() { - try!(shadow.to_css(dest)); - } else { - try!(dest.write_str("none")); - return Ok(()) + match iter.next() { + Some(shadow) => shadow.to_css(dest)?, + None => return dest.write_str("none"), } for shadow in iter { - try!(dest.write_str(", ")); - try!(shadow.to_css(dest)); + dest.write_str(", ")?; + shadow.to_css(dest)?; } Ok(()) } @@ -830,15 +825,15 @@ ${helpers.single_keyword("text-align-last", impl ToCss for SpecifiedTextShadow { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - try!(self.offset_x.to_css(dest)); - try!(dest.write_str(" ")); - try!(self.offset_y.to_css(dest)); - try!(dest.write_str(" ")); - try!(self.blur_radius.to_css(dest)); + self.offset_x.to_css(dest)?; + dest.write_str(" ")?; + self.offset_y.to_css(dest)?; + dest.write_str(" ")?; + self.blur_radius.to_css(dest)?; if let Some(ref color) = self.color { - try!(dest.write_str(" ")); - try!(color.to_css(dest)); + dest.write_str(" ")?; + color.to_css(dest)?; } Ok(()) }