From 38043a71de0cb57a529e049f9f28ada2ccd89c62 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 2 Sep 2017 10:24:18 +0200 Subject: [PATCH] Remove some uses of `write!` in components/style --- components/style/properties/shorthand/box.mako.rs | 4 ++-- components/style/values/generics/mod.rs | 5 ++++- components/style/values/specified/length.rs | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/style/properties/shorthand/box.mako.rs b/components/style/properties/shorthand/box.mako.rs index 209d33eb7b4..d838039c68c 100644 --- a/components/style/properties/shorthand/box.mako.rs +++ b/components/style/properties/shorthand/box.mako.rs @@ -176,7 +176,7 @@ macro_rules! try_parse_one { for i in 0..len { if i != 0 { - write!(dest, ", ")?; + dest.write_str(", ")?; } self.transition_property.0[i].to_css(dest)?; % for name in "duration timing_function delay".split(): @@ -289,7 +289,7 @@ macro_rules! try_parse_one { for i in 0..len { if i != 0 { - write!(dest, ", ")?; + dest.write_str(", ")?; } % for name in props[1:]: diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs index 16f90ec11a2..239b104d49d 100644 --- a/components/style/values/generics/mod.rs +++ b/components/style/values/generics/mod.rs @@ -226,7 +226,10 @@ impl ToCss for FontSettingTagInt { match self.0 { 1 => Ok(()), 0 => dest.write_str(" off"), - x => write!(dest, " {}", x) + x => { + dest.write_char(' ')?; + x.to_css(dest) + } } } } diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index c816e542020..3789a544669 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -424,7 +424,11 @@ impl ToCss for NoCalcLength { NoCalcLength::FontRelative(length) => length.to_css(dest), NoCalcLength::ViewportPercentage(length) => length.to_css(dest), /* This should only be reached from style dumping code */ - NoCalcLength::ServoCharacterWidth(CharacterWidth(i)) => write!(dest, "CharWidth({})", i), + NoCalcLength::ServoCharacterWidth(CharacterWidth(i)) => { + dest.write_str("CharWidth(")?; + i.to_css(dest)?; + dest.write_char(')') + } #[cfg(feature = "gecko")] NoCalcLength::Physical(length) => length.to_css(dest), }