We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2c9151 commit 7a52db5Copy full SHA for 7a52db5
src/krate.rs
@@ -1015,11 +1015,9 @@ pub fn downloads(req: &mut Request) -> CargoResult<Response> {
1015
WHERE date > $1
1016
AND version_id = ANY($2)
1017
ORDER BY date ASC")?;
1018
- let mut downloads = Vec::new();
1019
- for row in stmt.query(&[&cutoff_date, &ids])?.iter() {
1020
- let download: VersionDownload = Model::from_row(&row);
1021
- downloads.push(download.encodable());
1022
- }
+ let downloads = stmt.query(&[&cutoff_date, &ids])?.iter().map(|row| {
+ VersionDownload::from_row(&row).encodable()
+ }).collect::<Vec<_>>();
1023
1024
let stmt = tx.prepare("\
1025
SELECT COALESCE(to_char(DATE(version_downloads.date), 'YYYY-MM-DD'), '') AS date,
0 commit comments