Skip to content

Commit

Permalink
fix: correctly handle return (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
andylokandy committed Jun 19, 2024
1 parent cd96a27 commit f843fc8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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.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

0 comments on commit f843fc8

Please sign in to comment.