Skip to content

Remove unused code lint from allow list - #291

Merged
FalkWoldmann merged 3 commits into
httpmock:masterfrom
danieleades:claude/remove-unused-code-lint-b2f0he
Sep 29, 2026
Merged

FalkWoldmann merged 3 commits into
httpmock:masterfrom
danieleades:claude/remove-unused-code-lint-b2f0he

Conversation

@danieleades

@danieleades danieleades commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Removes dead_code = "allow" from [lints.rust].

The proxy, recording and remote code was defined unconditionally while every caller was already behind a #[cfg(feature = ...)], so most of it was dead in all but a handful of feature combinations. The fix pushes the gates down to the definitions rather than adding more at the call sites, and groups them so a feature is switched on in as few places as possible

@danieleades danieleades changed the title Claude/remove unused code lint b2f0he Remove unused code lint Aug 16, 2026
@codecov

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.65708% with 91 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/common/static_mock.rs 91.24% 33 Missing ⚠️
src/api/record.rs 78.78% 21 Missing ⚠️
src/server/handler.rs 76.27% 14 Missing ⚠️
src/server/state/record.rs 90.59% 11 Missing ⚠️
src/server/state/proxy.rs 88.40% 8 Missing ⚠️
src/server/state/mod.rs 98.52% 3 Missing ⚠️
src/server/builder.rs 96.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@danieleades
danieleades force-pushed the claude/remove-unused-code-lint-b2f0he branch from 330967a to d36005c Compare August 17, 2026 18:54
@danieleades danieleades changed the title Remove unused code lint Remove unused code lint from allow list Sep 2, 2026
@danieleades
danieleades force-pushed the claude/remove-unused-code-lint-b2f0he branch from 74a3678 to 4a8ef9c Compare September 4, 2026 07:30
@danieleades
danieleades force-pushed the claude/remove-unused-code-lint-b2f0he branch 2 times, most recently from 455025c to a94a7a2 Compare September 20, 2026 15:36
The proxy, recording and remote code was defined unconditionally while every
caller was already behind a `#[cfg(feature = ...)]`, so most of it was dead in
all but a handful of feature combinations. Push the gates down to the
definitions, and group them so a feature is switched on in as few places as
possible:

- move the `StaticMockDefinition` YAML representation out of `common::data`
  into `common::static_mock`, gated once on `record`
- split `Recording` and `RecordingRuleBuilder` out of `api::proxy` into
  `api::record`, so both modules are gated once at their declaration
- split `server::state` into `state::proxy` and `state::record`, with the rule
  and recording maps held in private sub-structs of the state
- collect the feature-dependent methods of `MockServer`, `HttpMockServerBuilder`
  and the request handler into one `impl` block per feature

`MockServerAdapter` keeps a `#[cfg]` per method, since adapters are used as
trait objects and cannot be split up.
Every feature combination is now free of dead code, so the allowance can go.
Also fixes what master broke without conflicts: gate the cookie readers now that httpmock#297 made cookies optional, drop the KeyValueOperator variants nothing constructs since httpmock#312 made matchers private, and remove a TryInto import the redundant_imports lint from httpmock#316 rejects.
@FalkWoldmann
FalkWoldmann merged commit c812789 into httpmock:master Sep 29, 2026
13 checks passed
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.

2 participants