mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
fix clippy warnings
This commit is contained in:
parent
01479dcf99
commit
abbea59732
17 changed files with 124 additions and 131 deletions
|
@ -37,13 +37,12 @@ async fn get_index(
|
|||
data: web::Data<Data>,
|
||||
path: web::Path<IndexParam>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
match data.index(&path.index_uid).await? {
|
||||
Some(meta) => {
|
||||
match data.index(path.index_uid.clone()).await {
|
||||
Ok(meta) => {
|
||||
let json = serde_json::to_string(&meta).unwrap();
|
||||
Ok(HttpResponse::Ok().body(json))
|
||||
}
|
||||
None => {
|
||||
let e = format!("Index {:?} doesn't exist.", path.index_uid);
|
||||
Err(e) => {
|
||||
Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +60,8 @@ async fn create_index(
|
|||
data: web::Data<Data>,
|
||||
body: web::Json<IndexCreateRequest>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
match data.create_index(&body.uid, body.primary_key.clone()).await {
|
||||
let body = body.into_inner();
|
||||
match data.create_index(body.uid, body.primary_key).await {
|
||||
Ok(meta) => {
|
||||
let json = serde_json::to_string(&meta).unwrap();
|
||||
Ok(HttpResponse::Ok().body(json))
|
||||
|
@ -95,7 +95,8 @@ async fn update_index(
|
|||
path: web::Path<IndexParam>,
|
||||
body: web::Json<UpdateIndexRequest>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
match data.update_index(&path.index_uid, body.primary_key.as_ref(), body.uid.as_ref()).await {
|
||||
let body = body.into_inner();
|
||||
match data.update_index(path.into_inner().index_uid, body.primary_key, body.uid).await {
|
||||
Ok(meta) => {
|
||||
let json = serde_json::to_string(&meta).unwrap();
|
||||
Ok(HttpResponse::Ok().body(json))
|
||||
|
@ -133,16 +134,13 @@ async fn get_update_status(
|
|||
data: web::Data<Data>,
|
||||
path: web::Path<UpdateParam>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let result = data.get_update_status(&path.index_uid, path.update_id).await;
|
||||
let params = path.into_inner();
|
||||
let result = data.get_update_status(params.index_uid, params.update_id).await;
|
||||
match result {
|
||||
Ok(Some(meta)) => {
|
||||
Ok(meta) => {
|
||||
let json = serde_json::to_string(&meta).unwrap();
|
||||
Ok(HttpResponse::Ok().body(json))
|
||||
}
|
||||
Ok(None) => {
|
||||
let e = format!("update {} for index {:?} doesn't exists.", path.update_id, path.index_uid);
|
||||
Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
|
||||
}
|
||||
Err(e) => {
|
||||
Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
|
||||
}
|
||||
|
@ -154,7 +152,7 @@ async fn get_all_updates_status(
|
|||
data: web::Data<Data>,
|
||||
path: web::Path<IndexParam>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let result = data.get_updates_status(&path.index_uid).await;
|
||||
let result = data.get_updates_status(path.into_inner().index_uid).await;
|
||||
match result {
|
||||
Ok(metas) => {
|
||||
let json = serde_json::to_string(&metas).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue