style: Avoid returning fmt::Errors for things that are not formatting errors

They are not. The serialization code already checks if the result is
empty, which can happen for other reasons. This makes the code a bit
more resilient to misuse.

Differential Revision: https://phabricator.services.mozilla.com/D115133
This commit is contained in:
Emilio Cobos Álvarez 2023-05-21 21:31:15 +02:00 committed by Oriol Brufau
parent 4bcf4573db
commit 9c32836913

View file

@ -1486,13 +1486,13 @@ impl ShorthandId {
// shorthand, since it only accepts CSS-wide keywords (and
// variable references), which will be handled in
// get_shorthand_appendable_value.
Err(fmt::Error)
Ok(())
}
% for property in data.shorthands_except_all():
ShorthandId::${property.camel_case} => {
match shorthands::${property.ident}::LonghandsToSerialize::from_iter(declarations) {
Ok(longhands) => longhands.to_css(dest),
Err(_) => Err(fmt::Error)
Err(_) => Ok(())
}
},
% endfor