chore: remove unmaintained boolinator dep#968
chore: remove unmaintained boolinator dep#968anikettuli wants to merge 2 commits intoStremio:developmentfrom
Conversation
Replace `boolinator::Boolinator` extension methods with stdlib equivalents (`bool::then`, `bool::then_some`). The crate has been unmaintained since 2016 and its functionality is covered by stable std since Rust 1.50/1.62. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stremio-core-web prebuildPrebuild artifact published by the Paste one of these into Release "@stremio/stremio-core-web": "https://stremio.github.io/stremio-core/stremio-core-web/claude/remove-boolinator-dep/stremio-stremio-core-web-0.56.3.tgz"Dev "@stremio/stremio-core-web": "https://stremio.github.io/stremio-core/stremio-core-web/claude/remove-boolinator-dep/dev/stremio-stremio-core-web-0.56.3.tgz" |
There was a problem hiding this comment.
Pull request overview
This PR removes the unmaintained boolinator crate from the workspace and replaces its Boolinator bool extension methods with Rust stdlib equivalents (bool::then and Option::flatten) to preserve behavior without the external dependency.
Changes:
- Removed
boolinatorfrom workspace andstremio-core-webdependencies. - Replaced
as_option()call sites withbool::then(...)(and onethen(...).flatten()case). - Dropped
boolinator::Boolinatorimports from affected Rust modules.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Cargo.toml |
Removes boolinator from workspace/root dependencies. |
stremio-core-web/Cargo.toml |
Removes boolinator from stremio-core-web dependencies. |
src/models/catalog_with_filters.rs |
Replaces as_option().map(...) with `then( |
src/types/resource/stream.rs |
Replaces as_option().and_then(...) with `then( |
stremio-core-web/src/model/serialize_discover.rs |
Replaces as_option().map(...) with `then( |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| either = "1.6" | ||
| enclose = "1.1" | ||
| derivative = "2.2" | ||
| derive_more = { version = "2", features = ["from", "into", "into_iterator", "try_into", "deref"] } | ||
| boolinator = "2.4" | ||
| strum = { version = "0.27", features = ["derive"] } |
- cargo fmt collapses the shorter .then(|| ...) call in catalog_with_filters.rs - Cargo.lock now reflects boolinator's absence from the dependency tree
|
Superseded by #973 — the five dead-weight/MSRV modernizations are bundled there to avoid five near-identical Cargo.toml / Cargo.lock merges. Each change remains a distinct commit for piecewise review. |
Summary
Remove the
boolinatorcrate (unmaintained since 2016 — last release August 2016) from the workspace. Replace itsBoolinator::as_option/as_someextension methods onboolwith stdlib equivalents (bool::then,bool::then_some).Why this change
boolinatoris unmaintained (no commits in 9+ years);rustsechas flagged it as a stale dependency in the past.bool::then(stable since Rust 1.50, May 2021) andbool::then_some(stable since Rust 1.62, June 2022) cover every call site. No third-party dep needed.Cargo.lockno longer resolvesboolinator 2.4.0.Effect
bool::then(F)returnsSome(F())when true;as_option(x)returnedSome(x)when true — equivalent exceptthenaccepts a closure so side-effectful arguments only execute on the truthy branch (never the case here).Call sites updated
src/models/catalog_with_filters.rs—(!extra_prop.is_required).as_option().map(|_| SelectableExtraOption { .. })→(!extra_prop.is_required).then(|| SelectableExtraOption { .. })src/types/resource/stream.rs(Stream::youtube) —cond.as_option().and_then(|_| split)→cond.then(|| split).flatten()stremio-core-web/src/model/serialize_discover.rs—(!discover.catalog.is_empty()).as_option().map(|_| ..)→.then(|| ..)Manifest changes:
Cargo.toml— dropboolinator = "2.4"stremio-core-web/Cargo.toml— dropboolinator = "2.4.*"Cargo.lock— regenerated (removes theboolinatorentry)Test plan
Verified locally on Windows 11 with
rustc 1.95.0 stable-x86_64-pc-windows-gnu:cargo test -p stremio-core --lib— 202 passed, 0 failedcargo clippy -p stremio-core --all-targets -- -D warnings— cleancargo fmt --check— clean (fixup commit082e3f63fapplies the formatting thatcargo fmtrequested after the.then(..)rewrite)Full-workspace build (including
stremio-core-web) needs thewasm-bindgenupgrade in #969 becausewasm-bindgen 0.2.78is incompatible with current Rust.