Skip to content

Commit

Permalink
feature rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ironpeak committed Nov 27, 2024
1 parent b1e6b44 commit 8b6ee21
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "slow_function_warning"
version = "0.3.0"
version = "0.4.0-rc.0"
authors = ["Hrafn Orri Hrafnkelsson <hrafn@vidfjord.is>"]
edition = "2021"
description = "A simple macro that prints a warning if a function takes longer than expected"
Expand All @@ -12,7 +12,8 @@ license = "MIT"

[features]
default = []
slow_function_warning = []
disabled = []
enabled = []

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn example_function() {
The warning is not on by default and is only recommended for debugging purposes. To enable it use the `slow_function_warning` feature.

~~~bash
cargo run --features slow_function_warning
cargo run --features slow_function_warning/enabled
~~~

## Custom Message Example
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn parse_time(expr: &Expr) -> Result<Duration> {

#[proc_macro_attribute]
pub fn slow_function_warning(args: TokenStream, input: TokenStream) -> TokenStream {
if !cfg!(feature = "slow_function_warning") {
if !cfg!(feature = "enabled") {
return input;
}
let args: Punctuated<Expr, Token![,]> = if !args.is_empty() {
Expand Down

0 comments on commit 8b6ee21

Please sign in to comment.