From 37a08a17d40690ece6c4c9d9ada9aaf4e5c33296 Mon Sep 17 00:00:00 2001 From: Paul Mattern <75864135+pemattern@users.noreply.github.com> Date: Sat, 11 Oct 2025 22:16:47 +0200 Subject: [PATCH] Fix misplaced comment in error handling example (#3529) --- examples/error-handling/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/error-handling/src/main.rs b/examples/error-handling/src/main.rs index 01ceeeb7..adc8efea 100644 --- a/examples/error-handling/src/main.rs +++ b/examples/error-handling/src/main.rs @@ -185,6 +185,7 @@ impl IntoResponse for AppError { let mut response = (status, AppJson(ErrorResponse { message })).into_response(); if let Some(err) = err { // Insert our error into the response, our logging middleware will use this. + // By wrapping the error in an Arc we can use it as an Extension regardless of any inner types not deriving Clone. response.extensions_mut().insert(Arc::new(err)); } response @@ -193,7 +194,6 @@ impl IntoResponse for AppError { impl From for AppError { fn from(rejection: JsonRejection) -> Self { - // Arc enables cloning of a JsonRejection Self::JsonRejection(rejection) } }