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

@ -215,15 +215,14 @@ impl ToCss for Expression {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,
{
write!(dest, "(")?;
let (mm, l) = match self.0 {
ExpressionKind::Width(Range::Min(ref l)) => ("min-", l),
ExpressionKind::Width(Range::Max(ref l)) => ("max-", l),
ExpressionKind::Width(Range::Eq(ref l)) => ("", l),
let (s, l) = match self.0 {
ExpressionKind::Width(Range::Min(ref l)) => ("(min-width: ", l),
ExpressionKind::Width(Range::Max(ref l)) => ("(max-width: ", l),
ExpressionKind::Width(Range::Eq(ref l)) => ("(width: ", l),
};
write!(dest, "{}width: ", mm)?;
dest.write_str(s)?;
l.to_css(dest)?;
write!(dest, ")")
dest.write_char(')')
}
}