mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Move away from the repeat().take().collect() pattern.
This was the preferred pattern between the deprecation of Vec::from_elem and the addition of the count argument to the vec![] macro.
This commit is contained in:
parent
6a728712f9
commit
ce4d442941
6 changed files with 7 additions and 16 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
use euclid::point::Point2D;
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::iter::repeat;
|
||||
use std::mem;
|
||||
use std::u16;
|
||||
use std::vec::Vec;
|
||||
|
@ -530,8 +529,7 @@ impl<'a> GlyphStore {
|
|||
assert!(length > 0);
|
||||
|
||||
GlyphStore {
|
||||
entry_buffer: repeat(GlyphEntry::initial()).take(length)
|
||||
.collect(),
|
||||
entry_buffer: vec![GlyphEntry::initial(); length],
|
||||
detail_store: DetailedGlyphStore::new(),
|
||||
is_whitespace: is_whitespace,
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ use libc::{c_uint, c_int, c_void, c_char};
|
|||
use util::geometry::Au;
|
||||
use util::range::Range;
|
||||
use std::char;
|
||||
use std::iter::repeat;
|
||||
use std::mem;
|
||||
use std::cmp;
|
||||
use std::ptr;
|
||||
|
@ -292,10 +291,9 @@ impl Shaper {
|
|||
|
||||
// fast path: all chars are single-byte.
|
||||
if byte_max == char_max {
|
||||
byte_to_glyph = repeat(NO_GLYPH).take(byte_max).collect();
|
||||
byte_to_glyph = vec![NO_GLYPH; byte_max];
|
||||
} else {
|
||||
byte_to_glyph = repeat(CONTINUATION_BYTE).take(byte_max)
|
||||
.collect();
|
||||
byte_to_glyph = vec![CONTINUATION_BYTE; byte_max];
|
||||
for (i, _) in text.char_indices() {
|
||||
byte_to_glyph[i] = NO_GLYPH;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue