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:
parent
47b3fb84b6
commit
cb09720d85
1 changed files with 14 additions and 14 deletions
28
src/lib.rs
28
src/lib.rs
|
@ -360,7 +360,7 @@ async fn handle_upload<S: Store + 'static>(
|
||||||
image.result.disarm();
|
image.result.disarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(HttpResponse::Created().json(&serde_json::json!({
|
Ok(HttpResponse::Created().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"files": files
|
"files": files
|
||||||
})))
|
})))
|
||||||
|
@ -462,7 +462,7 @@ async fn upload_backgrounded<S: Store>(
|
||||||
image.result.disarm();
|
image.result.disarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(HttpResponse::Accepted().json(&serde_json::json!({
|
Ok(HttpResponse::Accepted().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"uploads": files
|
"uploads": files
|
||||||
})))
|
})))
|
||||||
|
@ -496,7 +496,7 @@ async fn claim_upload<S: Store + 'static>(
|
||||||
UploadResult::Success { alias, token } => {
|
UploadResult::Success { alias, token } => {
|
||||||
let details = ensure_details(&state, &alias).await?;
|
let details = ensure_details(&state, &alias).await?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(&serde_json::json!({
|
Ok(HttpResponse::Ok().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"files": [{
|
"files": [{
|
||||||
"file": alias.to_string(),
|
"file": alias.to_string(),
|
||||||
|
@ -506,7 +506,7 @@ async fn claim_upload<S: Store + 'static>(
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity()
|
UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity()
|
||||||
.json(&serde_json::json!({
|
.json(serde_json::json!({
|
||||||
"msg": message,
|
"msg": message,
|
||||||
"code": code,
|
"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?;
|
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",
|
"msg": "ok",
|
||||||
"files": [{
|
"files": [{
|
||||||
"file": alias.to_string(),
|
"file": alias.to_string(),
|
||||||
|
@ -628,7 +628,7 @@ async fn do_download_backgrounded<S: Store + 'static>(
|
||||||
|
|
||||||
backgrounded.disarm();
|
backgrounded.disarm();
|
||||||
|
|
||||||
Ok(HttpResponse::Accepted().json(&serde_json::json!({
|
Ok(HttpResponse::Accepted().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"uploads": [{
|
"uploads": [{
|
||||||
"upload_id": upload_id.to_string(),
|
"upload_id": upload_id.to_string(),
|
||||||
|
@ -821,7 +821,7 @@ async fn process_details<S: Store>(
|
||||||
|
|
||||||
let details = details.ok_or(UploadError::NoFiles)?;
|
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> {
|
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?;
|
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
|
/// Fetch file details
|
||||||
|
@ -1087,7 +1087,7 @@ async fn details<S: Store + 'static>(
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let details = ensure_details(&state, &alias).await?;
|
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
|
/// Serve files based on alias query
|
||||||
|
@ -1550,7 +1550,7 @@ async fn purge<S>(
|
||||||
|
|
||||||
queue::cleanup_hash(&state.repo, hash).await?;
|
queue::cleanup_hash(&state.repo, hash).await?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(&serde_json::json!({
|
Ok(HttpResponse::Ok().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>()
|
"aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>()
|
||||||
})))
|
})))
|
||||||
|
@ -1573,7 +1573,7 @@ async fn delete_alias<S>(
|
||||||
return Ok(HttpResponse::NotFound().finish());
|
return Ok(HttpResponse::NotFound().finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(&serde_json::json!({
|
Ok(HttpResponse::Ok().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
@ -1587,7 +1587,7 @@ async fn aliases<S>(
|
||||||
|
|
||||||
let aliases = state.repo.aliases_from_alias(&alias).await?;
|
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",
|
"msg": "ok",
|
||||||
"aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>()
|
"aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>()
|
||||||
})))
|
})))
|
||||||
|
@ -1606,7 +1606,7 @@ async fn identifier<S>(
|
||||||
.await?
|
.await?
|
||||||
.ok_or(UploadError::MissingAlias)?;
|
.ok_or(UploadError::MissingAlias)?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(&serde_json::json!({
|
Ok(HttpResponse::Ok().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"identifier": identifier.as_ref(),
|
"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> {
|
async fn export_handler(repo: web::Data<SledRepo>) -> Result<HttpResponse, Error> {
|
||||||
repo.export().await?;
|
repo.export().await?;
|
||||||
|
|
||||||
Ok(HttpResponse::Created().json(&serde_json::json!({
|
Ok(HttpResponse::Created().json(serde_json::json!({
|
||||||
"msg": "ok"
|
"msg": "ok"
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue