Skip to content

Commit

Permalink
changed to format_ident
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver T <[email protected]>
  • Loading branch information
snOm3ad committed Aug 5, 2023
1 parent 8f06bbb commit d92aab4
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions crates/test-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
extern crate proc_macro;

use proc_macro2::*;
use quote::format_ident;
use quote::quote;
use quote::quote_spanned;
use std::sync::atomic::*;
Expand Down Expand Up @@ -89,16 +90,7 @@ pub fn wasm_bindgen_test(
// We generate a `#[no_mangle]` with a known prefix so the test harness can
// later slurp up all of these functions and pass them as arguments to the
// main test harness. This is the entry point for all tests.
let internal_id = ident
.to_string()
.strip_prefix("r#")
.map_or(ident.clone(), |s| Ident::new(s, Span::call_site()));
let name = format!(
"__wbgt_{}_{}",
internal_id,
CNT.fetch_add(1, Ordering::SeqCst)
);
let name = Ident::new(&name, Span::call_site());
let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst));
tokens.extend(
(quote! {
#[no_mangle]
Expand Down

0 comments on commit d92aab4

Please sign in to comment.