Skip to content

Commit 793a403

Browse files
committed
controllers/krate/versions: Avoid sorted_versions mutation while still borrowed
For some reason the Rust borrow checker is not currently complaining about this, but once the code is migrated to `diesel-async` it starts to fail the build.
1 parent aae25fe commit 793a403

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/controllers/krate/versions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ fn list_by_semver(
176176
}
177177
if let Some(start) = idx {
178178
let end = (start + options.per_page as usize).min(sorted_versions.len());
179-
let ids = sorted_versions[start..end].keys().collect::<Vec<_>>();
179+
let ids = sorted_versions[start..end]
180+
.keys()
181+
.cloned()
182+
.collect::<Vec<_>>();
180183
for result in versions::table
181184
.filter(versions::crate_id.eq(crate_id))
182185
.left_outer_join(users::table)

0 commit comments

Comments
 (0)