chore: Lint all cargo targets in CI - #203
Draft
jsonbailey wants to merge 1 commit into
Draft
jsonbailey wants to merge 1 commit into
jsonbailey wants to merge 1 commit into
Conversation
keelerm84
approved these changes
Sep 30, 2026
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
CI already runs clippy with
-D warnings, so lint findings do fail the build. What it does not do is pass--all-targets, so only the library target is linted — test modules and examples are never checked, and findings there accumulate invisibly.Adding
--all-targetssurfaced four, fixed here:useless_borrows_in_formattingsrc/events/sender.rs:356MultiContextBuildersrc/client.rs:924ContextBuilder,mockito::Matcher,test_case::test_case,ServiceEndpointsBuilder,EventFactorysrc/events/processor_builders.rs:342-347HyperTransport::new_httpsnot found (E0599)examples/custom_transport.rs:67The unused imports are not dead code. They serve tests behind
#[cfg(any(feature = ...))]gates, and the SDK's default feature set satisfies those gates, so the imports only go unused under--no-default-featuresvariants. Each import is now gated with the same expression as the test that consumes it rather than deleted.maplit::hashsetis deliberately left ungated — the test using it has no gate.The example was an oversight rather than a lint problem.
print_flagsandprogresseach declarerequired-features = ["hyper-rustls-native-roots"], butcustom_transporthad no[[example]]entry at all, so cargo built it unconditionally even thoughnew_https()needs rustls. It now declares the same requirement as its siblings; the example's code is unchanged. This was latent because the two matrix entries that would have broken it also passcargo-test-flags: --lib, so nothing compiled the example there.Testing
cargo clippy --all-targets -p launchdarkly-server-sdk -- -D warningsis clean for all seven CI matrix feature combinations, asserted on exit code rather than on output:--no-default-features--no-default-features --features hyper--no-default-features --features hyper-rustls-native-roots--no-default-features --features hyper-rustls-webpki-roots--no-default-features --features native-tls--no-default-features --features hyper-rustls-native-roots,crypto-opensslcargo test: 413 unit passed, 19 doc-tests passed, 0 failed — unchanged frommain. The diff touches no#[test],#[tokio::test], or#[test_case]line, so no test is newly gated out. Unit tests also pass under three--no-default-featuresvariants (397 / 408 / 408), and those counts tracking the feature gates is the cross-check that each gate matches its tests.cargo fmt --checkclean.contract-testswas already clean under--all-targetsand still is.A consequence worth knowing
CI pins the toolchain from
.github/variables/rust-versions.env(currentlytarget=1.96), andcheck-rust-versions.ymlopens an MSRV bump PR nightly. New toolchains add new lints, so widening clippy's scope means a future bump PR can go red on code nobody touched. That is the point — drift surfaces on the bump PR instead of hiding — but whoever handles those bot PRs should expect it. Thesender.rsfinding is an example: it does not fire on 1.96 and would have appeared at the next bump regardless.Note this PR's own CI runs clippy on 1.96, so it verifies the
--all-targetschange but cannot confirm the 1.98-only finding is gone. That was verified locally.Not in scope
--all-featuresdoes not compile, on an unrelated dependency conflict inhyper-http-proxy. Left alone.