Skip to content
Closed
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
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ fn gen_result_label_block(
let __input_string = format!(#input_format);
#[allow(unknown_lints)]
let __ret_value = async { #block }.await;
#[allow(unknown_lints)]
#[allow(clippy::ignored_unit_patterns)]
match __ret_value {
#ok_arm
#err_arm
Expand All @@ -435,6 +437,8 @@ fn gen_result_label_block(
#[allow(clippy::redundant_closure_call)]
#[allow(clippy::let_unit_value)]
let __ret_value = (move || #block)();
#[allow(unknown_lints)]
#[allow(clippy::ignored_unit_patterns)]
match __ret_value {
#ok_arm
#err_arm
Expand Down Expand Up @@ -489,6 +493,8 @@ fn gen_option_label_block(
let __input_string = format!(#input_format);
#[allow(unknown_lints)]
let __ret_value = async { #block }.await;
#[allow(unknown_lints)]
#[allow(clippy::ignored_unit_patterns)]
match __ret_value {
#some_arm
#none_arm
Expand All @@ -514,6 +520,8 @@ fn gen_option_label_block(
#[allow(clippy::redundant_closure_call)]
#[allow(clippy::let_unit_value)]
let __ret_value = (move || #block)();
#[allow(unknown_lints)]
#[allow(clippy::ignored_unit_patterns)]
match __ret_value {
#some_arm
#none_arm
Expand Down
32 changes: 32 additions & 0 deletions tests/ui/ok/unit-type-option.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Test for issue: logcall should not trigger clippy::ignored_unit_patterns warning
// for Option<()> return types

#![warn(clippy::pedantic)]
Copy link
Copy Markdown
Collaborator

@andylokandy andylokandy Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot change to deny

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright...


#[logcall::logcall(some = "debug", none = "info")]
pub async fn maybe() -> Option<()> {
Some(())
}

#[logcall::logcall(some = "info")]
pub async fn some_only() -> Option<()> {
Some(())
}

#[logcall::logcall(none = "info")]
pub async fn none_only() -> Option<()> {
None
}

#[logcall::logcall(some = "debug", none = "info")]
pub fn sync_maybe() -> Option<()> {
Some(())
}

#[tokio::main]
async fn main() {
let _ = maybe().await;
let _ = some_only().await;
let _ = none_only().await;
let _ = sync_maybe();
}
32 changes: 32 additions & 0 deletions tests/ui/ok/unit-type-result.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Test for issue: logcall should not trigger clippy::ignored_unit_patterns warning
// for Result<(), E> return types

#![warn(clippy::pedantic)]

#[logcall::logcall(ok = "debug", err = "error")]
pub async fn start() -> Result<(), String> {
Ok(())
}

#[logcall::logcall(ok = "info")]
pub async fn ok_only() -> Result<(), String> {
Ok(())
}

#[logcall::logcall(err = "error")]
pub async fn err_only() -> Result<(), String> {
Ok(())
}

#[logcall::logcall(ok = "debug", err = "error")]
pub fn sync_start() -> Result<(), String> {
Ok(())
}

#[tokio::main]
async fn main() {
let _ = start().await;
let _ = ok_only().await;
let _ = err_only().await;
let _ = sync_start();
}
Loading