mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Fix #[debug_handler] for multiple extractors (#552)
* Fix `#[debug_handler]` for multiple extractors It generated a function for each extractor to check the type but those functions didn't have unique names. Fixed by including all idents in the `arg: Extractor` token tree in the name of the function generated. Not sure there is a simpler way to fix it. * just use a counter * don't need visit feature anymore
This commit is contained in:
@@ -206,7 +206,8 @@ mod debug_handler {
|
||||
.sig
|
||||
.inputs
|
||||
.iter()
|
||||
.map(|arg| {
|
||||
.enumerate()
|
||||
.map(|(idx, arg)| {
|
||||
let (span, ty) = match arg {
|
||||
FnArg::Receiver(receiver) => {
|
||||
if receiver.reference.is_some() {
|
||||
@@ -227,7 +228,11 @@ mod debug_handler {
|
||||
}
|
||||
};
|
||||
|
||||
let name = format_ident!("__axum_debug_check_{}_from_request", item_fn.sig.ident);
|
||||
let name = format_ident!(
|
||||
"__axum_debug_check_{}_{}_from_request",
|
||||
item_fn.sig.ident,
|
||||
idx
|
||||
);
|
||||
quote_spanned! {span=>
|
||||
#[allow(warnings)]
|
||||
fn #name()
|
||||
|
||||
Reference in New Issue
Block a user