From 036b067d65b9234e45d3e9b45fa4dff4f506db8d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 15 Aug 2023 01:05:17 +0200 Subject: [PATCH] style: Update style to arrayvec 0.7 Differential Revision: https://phabricator.services.mozilla.com/D147476 --- components/style/properties/properties.mako.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 09602f5a529..4f430559fca 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2593,9 +2593,11 @@ impl PropertyDeclaration { } } -type SubpropertiesVec = ArrayVec; +const SUB_PROPERTIES_ARRAY_CAP: usize = + ${max(len(s.sub_properties) for s in data.shorthands_except_all()) \ + if data.shorthands_except_all() else 0}; + +type SubpropertiesVec = ArrayVec; /// A stack-allocated vector of `PropertyDeclaration` /// large enough to parse one CSS `key: value` declaration. @@ -2655,11 +2657,7 @@ impl SourcePropertyDeclaration { /// Return type of SourcePropertyDeclaration::drain pub struct SourcePropertyDeclarationDrain<'a> { - declarations: ArrayVecDrain< - 'a, PropertyDeclaration, - ${max(len(s.sub_properties) for s in data.shorthands_except_all()) \ - if data.shorthands_except_all() else 0} - >, + declarations: ArrayVecDrain<'a, PropertyDeclaration, SUB_PROPERTIES_ARRAY_CAP>, all_shorthand: AllShorthand, }