Skip to content

refactor: remove dead code and drop the url dependency - #246

Merged
FalkWoldmann merged 1 commit into
httpmock:masterfrom
danieleades:refactor/remove-dead-code
Aug 7, 2026
Merged

FalkWoldmann merged 1 commit into
httpmock:masterfrom
danieleades:refactor/remove-dead-code

Conversation

@danieleades

@danieleades danieleades commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Removes items with zero callers anywhere in the crate (src, tests, doc examples):

  • HttpMockBytes::{is_blank, contains_str, contains_slice, contains_vec}
  • HttpMockRequest::{query_params_map, to_http_request}
  • the dead enable_https field on HttpsConfigBuilder — it was only ever None, guarded an unreachable validate() branch, and had an orphaned doc comment for an enable/disable method that was never implemented
  • duplicate private converters in data.rs (from_string_pair_vec was byte-for-byte identical to to_name_value_string_pair_vec; from_pattern_vec was a needless clone)

Also switches query_params() / query_param_length() to parse the query string with form_urlencoded directly instead of the format!("http://dummy?{}") + Url::parse workaround — which removes the last use of the url crate, so the dependency is dropped.

Semver note

HttpMockRequest is re-exported at the crate root and is passed to user-provided matcher closures, so the removed pub methods were technically reachable downstream (e.g. req.body().contains_str(..)). Nothing in this repo uses them, but strictly this is API-trimming — flagging it so you can decide whether it should wait for a 0.9 release.

Overlap note

The private-converter cleanup in data.rs also appears in #247; the hunks are identical, so the PRs merge cleanly in either order.

Verification

Full cargo test --all-features suite passes locally, including all 138 doctests (which proves no doc example referenced the removed items).

Remove helpers with no callers anywhere in the crate:
- HttpMockBytes::{is_blank, contains_str, contains_slice, contains_vec}
- HttpMockRequest::{query_params_map, to_http_request}
- the dead enable_https field on HttpsConfigBuilder (only ever None,
  with an unreachable validate() branch and an orphaned doc comment)
- duplicate private converters in data.rs (from_string_pair_vec,
  from_pattern_vec)

Parse query strings with form_urlencoded directly instead of the
dummy-URL workaround, which removes the last use of the url crate.
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@FalkWoldmann

Copy link
Copy Markdown
Member

Good stuff, thanks! I guess this would warrant a 0.9 release since this is somewhat breaking, which is ok since we can use this release to clean up dubious APIs like these :D

@FalkWoldmann
FalkWoldmann merged commit f6c8f38 into httpmock:master Aug 7, 2026
9 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