Replace some more uses of write! in components/style

This commit is contained in:
Simon Sapin 2017-09-02 19:11:44 +02:00
parent fae2da0f59
commit 5d06c9959f
12 changed files with 33 additions and 28 deletions

View file

@ -68,7 +68,7 @@ impl Parse for SingleValue {
impl ToCss for SingleValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
write!(dest, "{}", self.0)
self.0.to_css(dest)
}
}
@ -105,9 +105,10 @@ impl Parse for PairValues {
impl ToCss for PairValues {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
write!(dest, "{}", self.0)?;
self.0.to_css(dest)?;
if let Some(second) = self.1 {
write!(dest, " {}", second)?;
dest.write_char(' ')?;
second.to_css(dest)?;
}
Ok(())
}
@ -158,10 +159,10 @@ impl ToCss for VectorValues {
let mut iter = self.0.iter();
let first = iter.next();
if let Some(first) = first {
write!(dest, "{}", first)?;
first.to_css(dest)?;
for value in iter {
dest.write_str(" ")?;
write!(dest, "{}", value)?;
dest.write_char(' ')?;
value.to_css(dest)?;
}
}
Ok(())