2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Clippy nit: borrowed value passed to json

This commit is contained in:
asonix 2024-11-12 13:54:13 -06:00
parent 47b3fb84b6
commit cb09720d85

View file

@ -360,7 +360,7 @@ async fn handle_upload<S: Store + 'static>(
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<S: Store>(
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<S: Store + 'static>(
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<S: Store + 'static>(
})))
}
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<S: Store + 'static>(
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<S: Store + 'static>(
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<S: Store>(
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<Option<(Alias, Hash)>, Error> {
@ -1076,7 +1076,7 @@ async fn details_query<S: Store + 'static>(
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<S: Store + 'static>(
) -> Result<HttpResponse, Error> {
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<S>(
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::<Vec<_>>()
})))
@ -1573,7 +1573,7 @@ async fn delete_alias<S>(
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<S>(
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::<Vec<_>>()
})))
@ -1606,7 +1606,7 @@ async fn identifier<S>(
.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<P: AsRef<Path>, T: serde::Serialize> ConfigSource<P, T> {
async fn export_handler(repo: web::Data<SledRepo>) -> Result<HttpResponse, Error> {
repo.export().await?;
Ok(HttpResponse::Created().json(&serde_json::json!({
Ok(HttpResponse::Created().json(serde_json::json!({
"msg": "ok"
})))
}