style: Use helper function to set length and copy into nsTArrays of PODs from Rust.

Differential Revision: https://phabricator.services.mozilla.com/D8058
This commit is contained in:
Cameron McCormack 2018-10-09 08:49:51 +00:00 committed by Emilio Cobos Álvarez
parent d960db340c
commit 4e174ace3b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 40 additions and 55 deletions

View file

@ -179,12 +179,7 @@ impl Parse for VectorValues {
#[cfg(feature = "gecko")]
impl ToGeckoFontFeatureValues for VectorValues {
fn to_gecko_font_feature_values(&self, array: &mut nsTArray<u32>) {
unsafe {
array.set_len_pod(self.0.len() as u32);
}
for (dest, value) in array.iter_mut().zip(self.0.iter()) {
*dest = *value;
}
array.assign_from_iter_pod(self.0.iter().map(|v| *v));
}
}