Skip to content

Commit

Permalink
Fix release build bug at cling_handler macro
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedSoliman committed Dec 1, 2023
1 parent 58eb175 commit 500f512
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "2"
members = ["cling", "cling-derive"]

[workspace.package]
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["Ahmed Farghal <me@asoli.dev>"]
license = "Apache-2.0 OR MIT"
Expand Down
6 changes: 4 additions & 2 deletions cling-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
//! Do not depend on this library directly. Instead, use `cling`

mod attributes;
#[cfg(debug_assertions)]
mod cling_handler;
mod derives;

use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput, ItemFn};
use syn::{parse_macro_input, DeriveInput};

#[proc_macro_derive(Run, attributes(cling, command, clap))]
pub fn derive_run(input: TokenStream) -> TokenStream {
Expand All @@ -23,10 +24,11 @@ pub fn derive_collect(input: TokenStream) -> TokenStream {
#[proc_macro_attribute]
pub fn cling_handler(_attr: TokenStream, function: TokenStream) -> TokenStream {
#[cfg(not(debug_assertions))]
return input;
return function;

#[cfg(debug_assertions)]
{
use syn::ItemFn;
let input = parse_macro_input!(function as ItemFn);
cling_handler::expand_handler(&input).into()
}
Expand Down

0 comments on commit 500f512

Please sign in to comment.