Skip to content

Commit

Permalink
Remove imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mejrs committed Apr 16, 2024
1 parent 2ad2a3f commit 6097d44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyo3-macros-backend/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,7 @@ fn module_initialization(options: PyModuleOptions, ident: &syn::Ident) -> TokenS
fn process_functions_in_module(options: &PyModuleOptions, func: &mut syn::ItemFn) -> Result<()> {
let ctx = &Ctx::new(&options.krate);
let Ctx { pyo3_path } = ctx;
let mut stmts: Vec<syn::Stmt> = vec![syn::parse_quote!(
#[allow(unknown_lints, unused_imports, redundant_imports)]
use #pyo3_path::{PyNativeType, types::PyModuleMethods};
)];
let mut stmts: Vec<syn::Stmt> = vec![];

for mut stmt in func.block.stmts.drain(..) {
if let syn::Stmt::Item(Item::Fn(func)) = &mut stmt {
Expand All @@ -395,7 +392,10 @@ fn process_functions_in_module(options: &PyModuleOptions, func: &mut syn::ItemFn
let name = &func.sig.ident;
let statements: Vec<syn::Stmt> = syn::parse_quote! {
#wrapped_function
#module_name.as_borrowed().add_function(#pyo3_path::wrap_pyfunction!(#name, #module_name.as_borrowed())?)?;
#pyo3_path::PyModuleMethods::add_function(
&#pyo3_path::PyNativeType::as_borrowed(&#module_name),
#pyo3_path::wrap_pyfunction!(#name, #pyo3_path::PyNativeType::as_borrowed(&#module_name))?
)?;
};
stmts.extend(statements);
}
Expand Down

0 comments on commit 6097d44

Please sign in to comment.