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 0a7ac80 commit d2c9151Copy full SHA for d2c9151
src/version.rs
@@ -307,11 +307,9 @@ pub fn downloads(req: &mut Request) -> CargoResult<Response> {
307
let stmt = tx.prepare("SELECT * FROM version_downloads
308
WHERE date > $1 AND version_id = $2
309
ORDER BY date ASC")?;
310
- let mut downloads = Vec::new();
311
- for row in stmt.query(&[&cutoff_date, &version.id])?.iter() {
312
- let download: VersionDownload = Model::from_row(&row);
313
- downloads.push(download.encodable());
314
- }
+ let downloads = stmt.query(&[&cutoff_date, &version.id])?.iter().map(|row| {
+ VersionDownload::from_row(&row).encodable()
+ }).collect();
315
316
#[derive(RustcEncodable)]
317
struct R { version_downloads: Vec<EncodableVersionDownload> }
0 commit comments