fix: silence pulsar warnings under no-compression feature sets#418
Open
merlimat wants to merge 1 commit into
Open
fix: silence pulsar warnings under no-compression feature sets#418merlimat wants to merge 1 commit into
merlimat wants to merge 1 commit into
Conversation
Building the pulsar crate without the `compression` feature (e.g. `--no-default-features --features tokio-runtime`) produces three warnings that are masked under the default feature set, which enables `compression`: - unused `io::Write` import in producer.rs - unnecessary `mut` on compress_message's `message` parameter - unnecessary `mut` on process_payload's `payload` parameter Gate the import and the `mut` bindings on the individual compression sub-features (lz4/flate2/zstd/snap) that actually use them, so the crate is warning-free across every feature combination -- including single-sub-feature builds like `--features lz4` -- without changing behavior under any feature. `io::Write` moves into the flate2/snap match arms, matching the existing `use std::io::Read;` convention in engine.rs.
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.
Problem
Building the
pulsarcrate without thecompressionfeature — e.g.produces three warnings that are masked under the default feature set (which enables
compression):src/producer.rs— unusedio::Writeimportsrc/producer.rs— unnecessarymutoncompress_message'smessageparametersrc/consumer/engine.rs— unnecessarymutonprocess_payload'spayloadparameterCI stays green today because both clippy jobs enable
compression, but the warnings surface for any downstream build that depends onpulsarwithdefault-features = falseand no compression features.Fix
Gate the import and the two
mutbindings on the individual compression sub-features (lz4/flate2/zstd/snap) that actually use them — rather than the umbrellacompressionfeature — so the crate is warning-free across every feature combination, including single-sub-feature builds like--features lz4, without changing behavior under any feature.io::Writeis moved out of the module-leveluseblock into theflate2/snapmatch arms (the only two that callwrite_all), matching the existinguse std::io::Read;convention already used for decompression inengine.rs.No behavior change: under a no-compression build the only reachable
matcharm moves the message/payload without mutating it, so themutis genuinely unused there.Verification
cargo clippy -p pulsar --no-default-features --features tokio-runtime -- -D warnings— now clean (previously 3 warnings)cargo clippy -p pulsar --features telemetry -- -D warnings— clean (compression-on path)cargo fmt --all --check— clean