Skip to content

Warn when append-on-drop guards are unused - #375

Open
danielgaskins wants to merge 1 commit into
awslabs:mainfrom
danielgaskins:fix/append-on-drop-must-use
Open

Warn when append-on-drop guards are unused#375
danielgaskins wants to merge 1 commit into
awslabs:mainfrom
danielgaskins:fix/append-on-drop-must-use

Conversation

@danielgaskins

Copy link
Copy Markdown
Contributor

Summary

  • mark AppendAndCloseOnDrop as must_use so unused guards produce a warning
  • make existing immediate emissions explicit with drop
  • add a compile-fail test for the warning and its guidance

Fixes #364

Testing

  • cargo +1.91 nextest run
  • cargo +1.91.0 test -p metrique --test ui
  • cargo +1.91 clippy --workspace --all-features -- -D warnings
  • cargo +nightly fmt --all -- --check

Comment thread metrique/src/lib.rs Outdated
Signed-off-by: Daniel Gaskins <danielgaskins99@gmail.com>
@danielgaskins
danielgaskins force-pushed the fix/append-on-drop-must-use branch from 8f86357 to 26e8baf Compare August 26, 2026 17:09
@danielgaskins

Copy link
Copy Markdown
Contributor Author

Hi @rcoh, could you take another look when you have a chance? The updated diagnostic now covers both options you suggested.

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.

Should AppendAndCloseOnDrop have #[must_use]?

2 participants