fc-server: fix clippy warnings about manual clamp patterns
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I5cc30a1f6f7444a7acd836430ad44a576a6a6964
This commit is contained in:
parent
6c322c061b
commit
d620ec5454
3 changed files with 88 additions and 88 deletions
|
|
@ -435,7 +435,7 @@ async fn projects_page(
|
|||
Query(params): Query<PageParams>,
|
||||
extensions: Extensions,
|
||||
) -> Html<String> {
|
||||
let limit = params.limit.unwrap_or(50).min(200).max(1);
|
||||
let limit = params.limit.unwrap_or(50).clamp(1, 200);
|
||||
let offset = params.offset.unwrap_or(0).max(0);
|
||||
let items = fc_common::repo::projects::list(&state.pool, limit, offset)
|
||||
.await
|
||||
|
|
@ -602,7 +602,7 @@ async fn evaluations_page(
|
|||
State(state): State<AppState>,
|
||||
Query(params): Query<PageParams>,
|
||||
) -> Html<String> {
|
||||
let limit = params.limit.unwrap_or(50).min(200).max(1);
|
||||
let limit = params.limit.unwrap_or(50).clamp(1, 200);
|
||||
let offset = params.offset.unwrap_or(0).max(0);
|
||||
let items = fc_common::repo::evaluations::list_filtered(
|
||||
&state.pool,
|
||||
|
|
@ -760,7 +760,7 @@ async fn builds_page(
|
|||
State(state): State<AppState>,
|
||||
Query(params): Query<BuildFilterParams>,
|
||||
) -> Html<String> {
|
||||
let limit = params.limit.unwrap_or(50).min(200).max(1);
|
||||
let limit = params.limit.unwrap_or(50).clamp(1, 200);
|
||||
let offset = params.offset.unwrap_or(0).max(0);
|
||||
let items = fc_common::repo::builds::list_filtered(
|
||||
&state.pool,
|
||||
|
|
|
|||
|
|
@ -8,13 +8,7 @@ use axum::{
|
|||
routing::get,
|
||||
};
|
||||
use fc_common::{
|
||||
models::{
|
||||
CreateStarredJob,
|
||||
CreateUser,
|
||||
PaginationParams,
|
||||
UpdateUser,
|
||||
User,
|
||||
},
|
||||
models::{CreateStarredJob, CreateUser, PaginationParams, UpdateUser, User},
|
||||
repo::{self},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue