fix(stylo_taffy): macro no-tracing arm consumes args to silence unused_variables#6
Merged
Merged
Conversation
…d_variables
The `log_fallback!()` macro has two arms — one for `feature = "tracing"`
that calls `tracing::debug!()` (which consumes both args), one for the
no-tracing build that was an empty `{}`. The empty arm leaves the
caller's bindings unused, producing a `unused_variables` warning at
call sites like:
unsupported => {
log_fallback!(&format!("display:{:?}", unsupported), "DEFAULT");
taffy::Display::DEFAULT
}
The `unsupported` binding becomes unused in no-tracing builds, even
though it IS used in the macro call (semantically). Compiler can't see
through the macro expansion to know that.
Fix: change the no-tracing arm to `let _ = (&$value, &$to);` which
consumes both args at the call site without emitting any code at
runtime. The `&` ensures we don't move out of the caller's bindings.
Backport of the same fix from DioxusLabs#443 (the upstream of
upstream — same macro, same problem, same fix). PR-D of 4 in the s190
cascade arc.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
The
log_fallback!()macro inconvert.rshas a#[cfg(not(feature = "tracing"))]arm that expands to empty{}. Empty expansion leaves caller bindings unconsumed, producing aunused_variableswarning at every match-arm call site. Fix: the no-tracing arm now doeslet _ = (&$value, &$to);which consumes the args at the call site (zero runtime cost, just a binding consumption).PR-D of 4 in the s190 cascade arc. Backport of the same fix from DioxusLabs/blitz#443 (upstream-of-upstream — same macro, same problem, same fix).
Changes
packages/stylo_taffy/src/convert.rs:75-78:#[cfg(not(feature = "tracing"))] macro_rules! log_fallback { - ($value:expr, $to:expr) => {}; + ($value:expr, $to:expr) => { + let _ = (&$value, &$to); + }; }Net delta: 3 LOC.
Why
The warning surfaces on every match-arm call site like:
The
unsupportedbinding gets bound by the match pattern, then passed to the macro. The compiler can't see through macro expansion — from its perspective the macro expanded to{}andunsupportedwas never used. Result:warning: unused variable: unsupportedat compile time in no-tracing builds (which is the default).The fix is the canonical "macro arm that wants to consume args without emitting runtime code": bind both args to
_. The&prevents move-out so the caller's bindings stay usable downstream (currently not needed but cheap insurance).Test plan
CARGO_TARGET_DIR=/build/target-foreman-bliss-main-merge cargo check -p stylo_taffy→ clean. The previously-warnedpackages/stylo_taffy/src/convert.rs:260:9unused_variableswarning is gone.let _ = (&_, &_)is a no-op after dead-code elimination).Downstream context
This is the same warning DioxusLabs#443 fixes upstream-of-upstream. Bliss-engine carries its own stylo_taffy fork (PR #1 landed the panic-elimination + tracing-feature work), so it doesn't auto-inherit the upstream fix. Backporting it here keeps bliss-engine no-tracing builds warning-clean and aligns the macro shape with blitz.
Generated with Claude Code