From 7f1495345aef1d13296fbc9f6538b2c7ec38d1f2 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Wed, 9 Nov 2022 12:49:44 +0100 Subject: [PATCH 1/3] Fix build --- axum/src/extract/matched_path.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/axum/src/extract/matched_path.rs b/axum/src/extract/matched_path.rs index ef20cdb911..5b69df6399 100644 --- a/axum/src/extract/matched_path.rs +++ b/axum/src/extract/matched_path.rs @@ -125,6 +125,7 @@ where #[derive(Clone, Debug)] struct MatchedNestedPath(Arc); +#[allow(unreachable_code)] pub(crate) fn set_matched_path_for_request( id: RouteId, route_id_to_path: &HashMap>, @@ -135,6 +136,7 @@ pub(crate) fn set_matched_path_for_request( } else { #[cfg(debug_assertions)] panic!("should always have a matched path for a route id"); + return; }; let matched_path = append_nested_matched_path(matched_path, extensions); From 5f49b6432a520a8ef4a214b4ac07f3fc73141447 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Wed, 9 Nov 2022 13:23:02 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Jonas Platte --- axum/src/extract/matched_path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axum/src/extract/matched_path.rs b/axum/src/extract/matched_path.rs index 5b69df6399..9ad5457bd0 100644 --- a/axum/src/extract/matched_path.rs +++ b/axum/src/extract/matched_path.rs @@ -125,7 +125,6 @@ where #[derive(Clone, Debug)] struct MatchedNestedPath(Arc); -#[allow(unreachable_code)] pub(crate) fn set_matched_path_for_request( id: RouteId, route_id_to_path: &HashMap>, @@ -136,6 +135,7 @@ pub(crate) fn set_matched_path_for_request( } else { #[cfg(debug_assertions)] panic!("should always have a matched path for a route id"); + #[cfg(not(debug_assertions))] return; }; From c1e3aeed17660bab9d6acf5aae4ef3c8e5dfb75a Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Wed, 9 Nov 2022 13:24:09 +0100 Subject: [PATCH 3/3] changelog --- axum/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 6db978fe98..9a3eca14a3 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased -- None. +- **fixed:** Fix compile error in release mode ([#1517]) + +[#1517]: https://github.com/tokio-rs/axum/pull/1517 # 0.6.0-rc.3 (8. November, 2022)