From cb09720d851b90cc1647c96b9b7cabda56896d5b Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 12 Nov 2024 13:54:13 -0600 Subject: [PATCH] Clippy nit: borrowed value passed to json --- src/lib.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dc90e96..e6e88b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,7 +360,7 @@ async fn handle_upload( image.result.disarm(); } - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok", "files": files }))) @@ -462,7 +462,7 @@ async fn upload_backgrounded( image.result.disarm(); } - Ok(HttpResponse::Accepted().json(&serde_json::json!({ + Ok(HttpResponse::Accepted().json(serde_json::json!({ "msg": "ok", "uploads": files }))) @@ -496,7 +496,7 @@ async fn claim_upload( UploadResult::Success { alias, token } => { let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "files": [{ "file": alias.to_string(), @@ -506,7 +506,7 @@ async fn claim_upload( }))) } UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity() - .json(&serde_json::json!({ + .json(serde_json::json!({ "msg": message, "code": code, }))), @@ -601,7 +601,7 @@ async fn do_download_inline( let (alias, delete_token, details) = ingest_inline(stream, state, upload_query).await?; - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok", "files": [{ "file": alias.to_string(), @@ -628,7 +628,7 @@ async fn do_download_backgrounded( backgrounded.disarm(); - Ok(HttpResponse::Accepted().json(&serde_json::json!({ + Ok(HttpResponse::Accepted().json(serde_json::json!({ "msg": "ok", "uploads": [{ "upload_id": upload_id.to_string(), @@ -821,7 +821,7 @@ async fn process_details( let details = details.ok_or(UploadError::NoFiles)?; - Ok(HttpResponse::Ok().json(&details.into_api_details())) + Ok(HttpResponse::Ok().json(details.into_api_details())) } async fn not_found_hash(repo: &ArcRepo) -> Result, Error> { @@ -1076,7 +1076,7 @@ async fn details_query( let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&details.into_api_details())) + Ok(HttpResponse::Ok().json(details.into_api_details())) } /// Fetch file details @@ -1087,7 +1087,7 @@ async fn details( ) -> Result { let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&details.into_api_details())) + Ok(HttpResponse::Ok().json(details.into_api_details())) } /// Serve files based on alias query @@ -1550,7 +1550,7 @@ async fn purge( queue::cleanup_hash(&state.repo, hash).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "aliases": aliases.iter().map(|a| a.to_string()).collect::>() }))) @@ -1573,7 +1573,7 @@ async fn delete_alias( return Ok(HttpResponse::NotFound().finish()); } - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", }))) } @@ -1587,7 +1587,7 @@ async fn aliases( let aliases = state.repo.aliases_from_alias(&alias).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "aliases": aliases.iter().map(|a| a.to_string()).collect::>() }))) @@ -1606,7 +1606,7 @@ async fn identifier( .await? .ok_or(UploadError::MissingAlias)?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "identifier": identifier.as_ref(), }))) @@ -1942,7 +1942,7 @@ impl, T: serde::Serialize> ConfigSource { async fn export_handler(repo: web::Data) -> Result { repo.export().await?; - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok" }))) }