Skip to content

Commit f3dde1c

Browse files
committed
controllers/krate: Simplify load_recent_downloads() signature
1 parent fd8bb8b commit f3dde1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/controllers/krate/metadata.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub async fn find_crate(
136136
),
137137
load_keywords(&mut conn, &krate, include.keywords),
138138
load_categories(&mut conn, &krate, include.categories),
139-
load_recent_downloads(&mut conn, &krate, include.downloads),
139+
load_recent_downloads(&mut conn, krate.id, include.downloads),
140140
)?;
141141

142142
let ids = versions_and_publishers
@@ -285,17 +285,17 @@ fn load_categories<'a>(
285285
async move { Ok(Some(fut.await?)) }.boxed()
286286
}
287287

288-
fn load_recent_downloads<'a>(
288+
fn load_recent_downloads(
289289
conn: &mut AsyncPgConnection,
290-
krate: &'a Crate,
290+
crate_id: i32,
291291
includes: bool,
292-
) -> BoxFuture<'a, AppResult<Option<i64>>> {
292+
) -> BoxFuture<'_, AppResult<Option<i64>>> {
293293
if !includes {
294294
return always_ready(|| Ok(None)).boxed();
295295
}
296296

297297
let fut = recent_crate_downloads::table
298-
.filter(recent_crate_downloads::crate_id.eq(krate.id))
298+
.filter(recent_crate_downloads::crate_id.eq(crate_id))
299299
.select(recent_crate_downloads::downloads)
300300
.get_result(conn);
301301
async move { Ok(fut.await.optional()?) }.boxed()

0 commit comments

Comments
 (0)