ref: narrow unused lint expectations in sentry-core hub#1079
Open
szokeasaurusrex wants to merge 4 commits intomasterfrom
Open
ref: narrow unused lint expectations in sentry-core hub#1079szokeasaurusrex wants to merge 4 commits intomasterfrom
szokeasaurusrex wants to merge 4 commits intomasterfrom
Conversation
Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
szokeasaurusrex
commented
Apr 23, 2026
Comment on lines
+11
to
+18
| /// Marks values as used in minimal builds where `with_client_impl!` turns many | ||
| /// method bodies into no-ops and would otherwise leave their parameters unused. | ||
| macro_rules! use_without_client { | ||
| ($($value:expr),+ $(,)?) => { | ||
| #[cfg(not(feature = "client"))] | ||
| let _ = ($( &$value ),+,); | ||
| }; | ||
| } |
Member
Author
There was a problem hiding this comment.
clanker came up with this idea, pretty nice. thanks GPT-5.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the blanket
#![allow(unused)]insentry-core/src/hub.rs. This will allow the linter to find problems like the following (from #1073) and many more, rather than needing to rely on the clanker for such things.Instead, we now have a macro that adds a
let _ = ...arguments...when theclientfeature is enabled. This solves the stated purpose of having theallow(unused)in the first place, but where more narrowly.The clanker also cleaned up some truly unused things that were suppressed before.
🤖What the clanker wrote
Description
Removes the blanket
#![allow(unused)]fromsentry-core/src/hub.rs.Instead of repeating a long
#[cfg_attr(not(feature = "client"), expect(unused, ...))]annotation across many parameters, this change uses a small documented localuse_without_client!helper macro that only touches those values innot(feature = "client")builds. That keeps the handling narrow to the specific methods and arguments that need it, while avoiding duplicated attributes in the signatures.Also cleans up truly unused imports, removes an unnecessary
mutin the release-health session setup path, and keeps the file rustfmt-clean for CI.Validated with:
cargo +1.88.0 fmt --all --checkcargo +1.88.0 clippy -p sentry-core --no-default-features -- -D warningscargo +1.88.0 clippy -p sentry-core --no-default-features --features client -- -D warningscargo +1.88.0 clippy -p sentry-core --all-features -- -D warningscargo +1.88.0 clippy -p sentry-core --no-default-features --features release-health -- -D warningscargo +1.88.0 clippy -p sentry-core --no-default-features --features logs -- -D warningsNote: a full local workspace
cargo clippy --all-features --workspace --tests --examples --lockedis blocked in this environment by missing system OpenSSL development libraries, which is unrelated to thishub.rschange.Issues
Reminders