Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly handle async #7

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading