Skip to content

Commit 21bf014

Browse files
linyihaisyphar
authored andcommitted
chore: inline the function retrive_sort_from_paginate
1 parent cf55c2b commit 21bf014

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/web/releases.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,6 @@ impl_axum_webpage! {
499499
status = |search| search.status,
500500
}
501501

502-
fn retrive_sort_from_paginate(query: &str) -> String {
503-
static RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"[?&]sort=([^&]+)").unwrap());
504-
let cap = RE.captures(query).unwrap();
505-
cap.get(1)
506-
.map_or("relevance".to_string(), |v| v.as_str().to_string())
507-
}
508-
509502
pub(crate) async fn search_handler(
510503
mut conn: DbConnection,
511504
Extension(pool): Extension<Pool>,
@@ -586,7 +579,14 @@ pub(crate) async fn search_handler(
586579
);
587580
return Err(AxumNope::NoResults);
588581
}
589-
sort_by = retrive_sort_from_paginate(&query_params);
582+
583+
static RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"[?&]sort=([^&]+)").unwrap());
584+
if let Some(cap) = RE.captures(&query_params) {
585+
sort_by = cap
586+
.get(1)
587+
.map_or("relevance".to_string(), |v| v.as_str().to_string());
588+
}
589+
590590
get_search_results(&mut conn, &config, &query_params).await?
591591
} else if !query.is_empty() {
592592
let query_params: String = form_urlencoded::Serializer::new(String::new())

0 commit comments

Comments
 (0)