Skip to content

Commit

Permalink
change: use stringify! in a few places in codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
jebrosen committed Apr 16, 2021
1 parent b1ab8c1 commit f2a7e25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions core/codegen/src/attribute/catch/mod.rs
Expand Up @@ -18,7 +18,6 @@ pub fn _catch(
// Gather everything we'll need to generate the catcher.
let user_catcher_fn = &catch.function;
let user_catcher_fn_name = &catch.function.sig.ident;
let generated_span_name = user_catcher_fn_name.to_string();
let vis = &catch.function.vis;
let status_code = Optional(catch.status.map(|s| s.code));

Expand Down Expand Up @@ -77,9 +76,9 @@ pub fn _catch(
.merge(__response)
.ok()
}.instrument(#_trace::info_span!(
#generated_span_name,
stringify!(#user_catcher_fn_name),
status = %#__status,
"Catcher: {}", #generated_span_name
"Catcher: {}", stringify!(#user_catcher_fn_name)
)))
}

Expand Down
5 changes: 2 additions & 3 deletions core/codegen/src/attribute/route/mod.rs
Expand Up @@ -246,7 +246,6 @@ fn codegen_route(route: Route) -> Result<TokenStream> {
let handler_fn_name = &handler_fn.sig.ident;
let internal_uri_macro = internal_uri_macro_decl(&route);
let responder_outcome = responder_outcome_expr(&route);
let generated_span_name = handler_fn_name.to_string();

let method = route.attr.method;
let path = route.attr.uri.to_string();
Expand Down Expand Up @@ -278,10 +277,10 @@ fn codegen_route(route: Route) -> Result<TokenStream> {

#responder_outcome
}.instrument(#_trace::info_span!(
#generated_span_name,
stringify!(#handler_fn_name),
method = %#method,
path = #path,
"Route: {}", #generated_span_name
"Route: {}", stringify!(#handler_fn_name)
)))
}

Expand Down

0 comments on commit f2a7e25

Please sign in to comment.