Skip to content

Conversation

Copy link

Copilot AI commented Dec 8, 2025

The macro generates match patterns like Ok(_) and Some(_) which trigger clippy's ignored_unit_patterns lint when the inner type is (). This occurs with functions returning Result<(), E> or Option<()>.

Changes

  • Added #[allow(clippy::ignored_unit_patterns)] to generated match statements in gen_result_label_block and gen_option_label_block (4 locations total - async/sync branches for each)
  • Added test coverage for Result<(), E> and Option<()> return types with pedantic lints enabled

Example

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

Previously triggered: warning: matching over () is more explicit on the function signature line when compiled with #[warn(clippy::pedantic)].

Original prompt

This section details on the original issue you should resolve

<issue_title>In certain case, logcall triggers clippy warning.</issue_title>
<issue_description>For function like this:

#[logcall(ok = "debug", err = "error")]
pub async fn start(&self) -> anyhow::Result<()> {
    // some other codes
    Ok(())
}

A note from clippy on the fn line.

matching over `()` is more explicit
for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#ignored_unit_patterns
`#[warn(clippy::ignored_unit_patterns)]` implied by `#[warn(clippy::pedantic)]`
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 8, 2025 09:29
Co-authored-by: andylokandy <9637710+andylokandy@users.noreply.github.com>
…nit types

Co-authored-by: andylokandy <9637710+andylokandy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Clippy warning in logcall for start function Suppress clippy::ignored_unit_patterns in generated match expressions Dec 8, 2025
Copilot AI requested a review from andylokandy December 8, 2025 09:39
@andylokandy andylokandy changed the title Suppress clippy::ignored_unit_patterns in generated match expressions chore: suppress clippy::ignored_unit_patterns in generated match expressions Dec 8, 2025
@andylokandy andylokandy marked this pull request as ready for review December 8, 2025 10:26
// Test for issue: logcall should not trigger clippy::ignored_unit_patterns warning
// for Option<()> return types

#![warn(clippy::pedantic)]
Copy link
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
Collaborator

Choose a reason for hiding this comment

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

Alright...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In certain case, logcall triggers clippy warning.

2 participants