emit! macro triggers clippy::vec_init_then_push warning #105
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jwilger/eventcore#105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The
emit!macro triggers a false positive clippy warning when used with an empty vector that was just created. This forces users to add#[allow(clippy::vec_init_then_push)]annotations to their code.Steps to Reproduce
Expected Behavior
The
emit!macro should not trigger clippy warnings about vector initialization patterns.Actual Behavior
Clippy produces the following warning:
Analysis
The macro appears to expand to code that immediately pushes to a vector after creation, which triggers the
vec_init_then_pushlint. This is a false positive because:#[allow(clippy::vec_init_then_push)]annotationsSuggested Fix
The macro could be updated to:
#[allow(clippy::vec_init_then_push)]internally within the macro expansionWorkaround
Users must add
#[allow(clippy::vec_init_then_push)]to methods that use theemit!macro:Environment
Related
This issue was discovered while implementing the macros in union_square after the fix for #97: https://github.com/jwilger/union_square/pull/107