diff --git a/lua_macros/src/generate_noop_lua_function.rs b/lua_macros/src/generate_noop_lua_function.rs deleted file mode 100644 index eac9e0a..0000000 --- a/lua_macros/src/generate_noop_lua_function.rs +++ /dev/null @@ -1,11 +0,0 @@ -use proc_macro2::TokenStream as TokenStream2; -use quote::ToTokens; - -// TODO: Do we need this noop? -pub fn generate_default_lua_function(input: &syn::Field) -> TokenStream2 { - let output: TokenStream2 = syn::parse(input.into_token_stream().into()) - .expect("This is generated from valid rust code, it should stay that way."); - - output -} - diff --git a/lua_macros/src/lib.rs b/lua_macros/src/lib.rs index 12fe422..7e4b612 100644 --- a/lua_macros/src/lib.rs +++ b/lua_macros/src/lib.rs @@ -1,8 +1,6 @@ -mod generate_noop_lua_function; mod mark_as_ci_command; mod struct_to_ci_enum; -use generate_noop_lua_function::generate_default_lua_function; use mark_as_ci_command::generate_final_function; use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; @@ -30,21 +28,18 @@ pub fn turn_struct_to_ci_commands(_attrs: TokenStream, input: TokenStream) -> To } /// Generate a default lua function implementation. +// TODO: Is this needed? #[proc_macro_attribute] pub fn gen_lua_function(_attrs: TokenStream, input: TokenStream) -> TokenStream { // Construct a representation of Rust code as a syntax tree // that we can manipulate - // let parser = Field::parse_named; let input = parser.parse(input) .expect("This is only defined for named fileds."); - // Build the trait implementation - let default_lua_function: TokenStream2 = generate_default_lua_function(&input); - quote! { - #default_lua_function + #input } .into() } diff --git a/lua_macros/src/mark_as_ci_command.rs b/lua_macros/src/mark_as_ci_command.rs index 08b715a..3a865db 100644 --- a/lua_macros/src/mark_as_ci_command.rs +++ b/lua_macros/src/mark_as_ci_command.rs @@ -26,21 +26,7 @@ fn append_tx_send_code(input: &mut syn::ItemFn) -> &mut syn::ItemFn { let tx_send = match &input.sig.output { syn::ReturnType::Default => { - todo!( - "Does this case even trigger? All functions should have a output of (Result<$type, rlua::Error>)" - ); - quote! { - { - let tx: std::sync::mpsc::Sender = - context - .named_registry_value("sender_for_ci_commands") - .expect("This exists, it was set before"); - - tx - .send(Event::CommandEvent(Command::#function_name_pascal)) - .expect("This should work, as the reciever is not dropped"); - } - } + unreachable!("All functions should have a output of (Result<$type, rlua::Error>)"); } syn::ReturnType::Type(_, ret_type) => { let return_type = match *(ret_type.clone()) {