Skip to content

Commit 1682066

Browse files
committed
Make clippy happy
1 parent 5667d35 commit 1682066

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/controllers/category.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn index(req: &mut dyn Request) -> CargoResult<Response> {
1616
let offset = options.offset().unwrap_or_default();
1717
let sort = query.get("sort").map_or("alpha", String::as_str);
1818

19-
let categories = Category::toplevel(&conn, sort, options.per_page as i64, offset as i64)?;
19+
let categories = Category::toplevel(&conn, sort, i64::from(options.per_page), i64::from(offset))?;
2020
let categories = categories.into_iter().map(Category::encodable).collect();
2121

2222
// Query for the total count of categories

src/controllers/helpers/pagination.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ where
174174
out.push_sql("SELECT *, COUNT(*) OVER () FROM (");
175175
self.query.walk_ast(out.reborrow())?;
176176
out.push_sql(") t LIMIT ");
177-
out.push_bind_param::<BigInt, _>(&(self.options.per_page as i64))?;
177+
out.push_bind_param::<BigInt, _>(&i64::from(self.options.per_page))?;
178178
if let Some(offset) = self.options.offset() {
179179
out.push_sql(" OFFSET ");
180-
out.push_bind_param::<BigInt, _>(&(offset as i64))?;
180+
out.push_bind_param::<BigInt, _>(&i64::from(offset))?;
181181
}
182182
Ok(())
183183
}

src/models/krate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,8 @@ impl Crate {
537537
let offset = options.offset().unwrap_or_default();
538538
let rows = sql_query(include_str!("krate_reverse_dependencies.sql"))
539539
.bind::<Integer, _>(self.id)
540-
.bind::<BigInt, _>(offset as i64)
541-
.bind::<BigInt, _>(options.per_page as i64)
540+
.bind::<BigInt, _>(i64::from(offset))
541+
.bind::<BigInt, _>(i64::from(options.per_page))
542542
.load::<WithCount<ReverseDependency>>(conn)?;
543543

544544
Ok(rows.records_and_total())

0 commit comments

Comments
 (0)