Skip to content

Commit

Permalink
format_ident! is much nicer than string concat
Browse files Browse the repository at this point in the history
  • Loading branch information
MusicalNinjaDad committed Apr 23, 2024
1 parent f896cb4 commit f99dbd2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pyo3-testing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Debug;

use proc_macro::TokenStream as TokenStream1;
use proc_macro2::{Span, TokenStream as TokenStream2};
use quote::ToTokens;
use quote::{format_ident, ToTokens};
use syn::{
parse::{Parse, ParseStream},
parse2, parse_quote,
Expand Down Expand Up @@ -187,10 +187,7 @@ fn wrap_testcase(mut testcase: Pyo3TestCase) -> TokenStream2 {
py_ModuleNotFoundErrormsgs.push("Failed to import ".to_string() + &py_modulename);
py_moduleidents.push(Ident::new(&py_modulename, Span::call_site()));
py_modulenames.push(py_modulename);
o3_pymoduleidents.push(Ident::new(
&("".to_string() + &pyo3import.o3_moduleident.to_string() + "_pymodule"),
Span::call_site(),
));
o3_pymoduleidents.push(format_ident!("{}_pymodule", pyo3import.o3_moduleident));
o3_moduleidents.push(pyo3import.o3_moduleident);
}

Expand Down

0 comments on commit f99dbd2

Please sign in to comment.