From ad8ef1cf8ca02b6da8dc9640507fa1d16100f8de Mon Sep 17 00:00:00 2001 From: Marshall Ku Date: Sat, 7 Sep 2024 14:58:30 +0900 Subject: [PATCH] Remove unnecessary borrow expressions and immediate dereferences --- src/utils/img.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/img.rs b/src/utils/img.rs index 1eb0d85..7890465 100644 --- a/src/utils/img.rs +++ b/src/utils/img.rs @@ -29,19 +29,19 @@ pub async fn save_resized_image( target_path: &PathBuf, ) -> Response { if width.is_none() { - return response_file(&target_path).await; + return response_file(target_path).await; } if image.width() <= width.unwrap() { - copy(&original_path, &target_path).ok(); - return response_file(&target_path).await; + copy(original_path, target_path).ok(); + return response_file(target_path).await; } let resize_height = width.unwrap() * image.height() / image.width(); let resized_image = image.thumbnail(width.unwrap(), resize_height); match resized_image.save(target_path.clone()) { - Ok(_) => response_file(&target_path).await, + Ok(_) => response_file(target_path).await, Err(_) => response_error(StatusCode::INTERNAL_SERVER_ERROR), } }