Skip to content

Commit

Permalink
fix: correctly handle async (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
andylokandy authored Jun 19, 2024
1 parent f843fc8 commit fc49f28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "logcall"
version = "0.1.8"
version = "0.1.9"
edition = "2021"
authors = ["andylokandy <[email protected]>"]
description = "An attribute macro that logs the function return value."
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ fn gen_block(
#[allow(clippy::useless_format)]
let __input_string = format!(#input_format);
#[allow(unknown_lints)]
#[allow(clippy::redundant_closure_call)]
let __ret_value = (move || #block)();
let __ret_value = async { #block }.await;
#log;
__ret_value
);
Expand All @@ -211,6 +210,7 @@ fn gen_block(
let __input_string = format!(#input_format);
#[allow(unknown_lints)]
#[allow(clippy::redundant_closure_call)]
#[allow(clippy::let_unit_value)]
let __ret_value = (move || #block)();
#log;
__ret_value
Expand Down Expand Up @@ -258,8 +258,7 @@ fn gen_block(
#[allow(clippy::useless_format)]
let __input_string = format!(#input_format);
#[allow(unknown_lints)]
#[allow(clippy::redundant_closure_call)]
let __ret_value = (move || #block)();
let __ret_value = async { #block }.await;
match __ret_value {
#ok_arm
#err_arm
Expand All @@ -283,6 +282,7 @@ fn gen_block(
let __input_string = format!(#input_format);
#[allow(unknown_lints)]
#[allow(clippy::redundant_closure_call)]
#[allow(clippy::let_unit_value)]
let __ret_value = (move || #block)();
match __ret_value {
#ok_arm
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/ok/minitrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ fn f() {}

#[logcall::logcall]
#[minitrace::trace]
async fn g() {}
async fn g() {
std::future::ready(1).await;
}

fn main() {
f();
Expand Down

0 comments on commit fc49f28

Please sign in to comment.