From 6cb9091dc864cd5ae6cc844e2749d51fbb7df6ea Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 6 Mar 2025 17:18:02 -0500 Subject: [PATCH] Remove unused macro method --- macros/src/lib.rs | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/macros/src/lib.rs b/macros/src/lib.rs index e5b6702f7..0fd69a4db 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,7 +1,7 @@ mod args; use args::{RegisterExtensionInput, ScalarInfo}; use quote::{format_ident, quote}; -use syn::{parse_macro_input, DeriveInput, Item, ItemFn, ItemMod}; +use syn::{parse_macro_input, DeriveInput, ItemFn}; extern crate proc_macro; use proc_macro::{token_stream::IntoIter, Group, TokenStream, TokenTree}; use std::collections::HashMap; @@ -980,42 +980,3 @@ pub fn register_extension(input: TokenStream) -> TokenStream { TokenStream::from(expanded) } - -/// Recursively search for a function in the module tree -fn find_function_path( - function_name: &syn::Ident, - module_path: String, - items: &[Item], -) -> Option { - for item in items { - match item { - // if it's a function, check if its name matches - Item::Fn(func) if func.sig.ident == *function_name => { - return Some(module_path.clone()); - } - // recursively search inside modules - Item::Mod(ItemMod { - ident, - content: Some((_, sub_items)), - .. - }) => { - let new_path = format!("{}::{}", module_path, ident); - if let Some(path) = find_function_path(function_name, new_path, sub_items) { - return Some(path); - } - } - _ => {} - } - } - None -} - -fn locate_function(ident: syn::Ident) -> syn::Ident { - let syntax_tree: syn::File = syn::parse_file(include_str!("lib.rs")).unwrap(); - - if let Some(full_path) = find_function_path(&ident, "crate".to_string(), &syntax_tree.items) { - return format_ident!("{full_path}::{ident}"); - } - - panic!("Function `{}` not found in crate!", ident); -}