Remove unneeded collect during line rect creation

This commit is contained in:
Mark Lodato 2020-10-22 15:39:38 -04:00 committed by GitHub
parent 80688e082d
commit f33a44e1c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -142,10 +142,9 @@ impl RenderLines {
pub fn rects(&self, metrics: &Metrics, size: &SizeInfo) -> Vec<RenderRect> {
self.inner
.iter()
.map(|(flag, lines)| -> Vec<RenderRect> {
lines.iter().map(|line| line.rects(*flag, metrics, size)).flatten().collect()
.flat_map(|(flag, lines)| {
lines.iter().flat_map(move |line| line.rects(*flag, metrics, size))
})
.flatten()
.collect()
}