Repository navigation
feat: reduce dependency tree by ~30% for default and minimal builds - #297
Merged
Merged
Conversation
) Cuts 22 crates from the default build (86 -> 64) and the minimal build (74 -> 52) without removing functionality: - Gate hyper-util/server-auto behind the http2 feature. It unconditionally enabled hyper/http2, pulling the h2 subtree (indexmap, hashbrown, slab, tokio-util, ...) into every build. Without http2, the server now uses hyper's plain http1 builder with upgrade support. - Replace async-object-pool with a small in-crate, runtime-agnostic pool based on std Mutex + tokio::sync::Semaphore (reactor-free, works under smol/actix-rt; covered by unit tests including a no-tokio-runtime test). - Drop futures-util: shared() replaced with pin!-based re-polling, pin_mut! with std::pin::pin!, BoxFuture spelled out. - Inline small helpers to drop tabwriter (+unicode-width), stringmetrics, and serde_regex. The Levenshtein replacement was differential-tested against stringmetrics (20k randomized cases) and trims common prefix/suffix; the tab alignment produces byte-identical output for all patterns this crate generates. - Move tokio/signal into the standalone feature (only used by the binary). - Fix a latent check-then-install race on the rustls CryptoProvider that surfaced once pool object creation was no longer serialized. Behavior change (documented in CHANGELOG): cleartext HTTP/2 prior-knowledge connections now require the http2 feature. Closes #46
Member
Author
|
Candidate for release 10.x.x . |
FalkWoldmann
self-requested a review
September 20, 2026 15:02
| tracing = { version = "0.1", features = ["log"] } | ||
| stringmetrics = "2" | ||
| assert-json-diff = "2" | ||
| async-trait = "0.1" |
Member
There was a problem hiding this comment.
Would also be great to get rid of this one but probably not possible due to dyn
| /// output for the patterns this module generates. It measures cell width in `char`s | ||
| /// rather than display columns, so cells containing wide characters (e.g. CJK) may | ||
| /// align differently in terminals. | ||
| struct TabWriter { |
Member
There was a problem hiding this comment.
Overall I like getting rid of external deps but I would still argue for tabwriter to stay since it's from a well known and trusted author
# Conflicts: # CHANGELOG.md # src/server/matchers/comparators.rs # src/server/matchers/comparison.rs
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
FalkWoldmann
added a commit
to danieleades/httpmock
that referenced
this pull request
Sep 27, 2026
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.
This was referenced Oct 3, 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.
Closes #46 (revives the old dependency-reduction effort;
isahc/async-stdfrom the original report are long gone, this addresses what remained).Results
--no-default-featuresChanges
hyper-util/server-autobehind thehttp2feature. It unconditionally enabledhyper/http2, pulling theh2subtree (indexmap,hashbrown,equivalent,fnv,slab,tokio-util,atomic-waker) into every build regardless of thehttp2feature. Withouthttp2, the server now uses hyper's plainhttp1::Builderwith.with_upgrades()(CONNECT tunneling still works; verified by the https/proxy tests).async-object-poolwith a small in-crate pool (src/common/pool.rs, −5 crates):std::sync::Mutex<Vec<T>>+tokio::sync::Semaphore, which is reactor-free and therefore runtime-agnostic — unit tests cover reuse, blocking at capacity, panic-safe creation, and operation under smol without a tokio runtime.futures-util(−5 crates):.shared()→std::pin::pin!+&mutre-polling inselect!;pin_mut!→std::pin::pin!;BoxFuturespelled out.tabwriter(+unicode-width),stringmetrics,serde_regex.tokio/signalinto thestandalonefeature (−1 crate): only the binary uses signal handling.CryptoProviderinstall race insrc/common/http.rs: check-then-install could panic when two clients were created concurrently. The old pool masked it by serializing creation under its lock.Verification
stringmetrics(20,000 randomized cases across both original call sites — exact agreement), and the tab alignment againsttabwriter(byte-identical output for all patterns this crate emits, including theminwidth: 2default).stringmetrics' prefix/suffix trimming (avoids O(n·m) blowup on large bodies), bounded the DP row by the shorter operand,Semaphore::MAX_PERMITSclamp, and assorted cleanups.cargo testpasses for default,--no-default-features, and--all-features;cargo checkpasses forstandalone,https,http2,remote,record; clippy and rustfmt clean.Behavior change
Cleartext HTTP/2 prior-knowledge connections (e.g. gRPC clients) now require the
http2feature — previously they worked in every build only becauseserver-autoforce-enabled HTTP/2. Documented in CHANGELOG.md. Known cosmetic limitation: the inlined tab alignment measureschars instead of Unicode display columns; this can only affect failure-report alignment when user data contains both a literal tab and wide characters (noted in a doc comment).