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 return #6

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.7"
version = "0.1.8"
edition = "2021"
authors = ["andylokandy <[email protected]>"]
description = "An attribute macro that logs the function return value."
Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ fn gen_block(
#[allow(unknown_lints)]
#[allow(clippy::useless_format)]
let __input_string = format!(#input_format);
let __ret_value = #block;
#[allow(unknown_lints)]
#[allow(clippy::redundant_closure_call)]
let __ret_value = (move || #block)();
#log;
__ret_value
);
Expand Down Expand Up @@ -255,7 +257,9 @@ fn gen_block(
#[allow(unknown_lints)]
#[allow(clippy::useless_format)]
let __input_string = format!(#input_format);
let __ret_value = #block;
#[allow(unknown_lints)]
#[allow(clippy::redundant_closure_call)]
let __ret_value = (move || #block)();
match __ret_value {
#ok_arm
#err_arm
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/ok/unreachable.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(unreachable_code)]

#[logcall::logcall("info")]
async fn f(a: u32) -> u32 {
if a == 1 {
Expand Down
Loading