Skip to content

Commit 6286ec6

Browse files
committed
Remove a mut vec
1 parent 7a52db5 commit 6286ec6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/krate.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,13 +1030,12 @@ pub fn downloads(req: &mut Request) -> CargoResult<Response> {
10301030
AND versions.id != ALL($3)
10311031
GROUP BY DATE(version_downloads.date)
10321032
ORDER BY DATE(version_downloads.date) ASC")?;
1033-
let mut extra = Vec::new();
1034-
for row in stmt.query(&[&cutoff_date, &krate.id, &ids])?.iter() {
1035-
extra.push(ExtraDownload {
1033+
let extra = stmt.query(&[&cutoff_date, &krate.id, &ids])?.iter().map(|row| {
1034+
ExtraDownload {
10361035
downloads: row.get("downloads"),
10371036
date: row.get("date")
1038-
});
1039-
}
1037+
}
1038+
}).collect::<Vec<_>>();
10401039

10411040
#[derive(RustcEncodable)]
10421041
struct ExtraDownload { date: String, downloads: i64 }

0 commit comments

Comments
 (0)