must-use-result: a feature pack's Result compared with undefined or null isn't looked at #167
Loading…
Reference in a new issue
No description provided.
Delete branch "pack-result-compared"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found reviewing #158 before landing it. std's
ResultisT | Err<E>, so after #158 madegetItemandkeyreturnResult<Option<string>, E>, code written the way the docs showed before (return getItem(localStorage, "draft") !== undefined;) still type-checks, and on a store the browser refuses theErrcounts as "draft present". Nothing reported it:must-use-resultonly fired when the value was dropped, logged or turned into text.What changes
kept::weak_userecognises a comparison withundefined,void 0ornullas "only compares it withundefined, which anErrisn't either".LibCall::weak_use, reported in the pack loop ofproject.rs) and kept in a local (kept_resultspasses the pack calls ascomparedtokept::collect_in, andlocal()keeps such keepings as candidates). A function's ownResult<void, E>tested withr === undefinedstill counts as a test (kept_resultsfixture, "Looked at: tested"), as do std'sunsafe(...)andparseJson.console.log(getItem(localStorage, k))) are now reported like the user's own functions; a pack call kept in a local nothing looks at was reported twice (pack loop and calls loop) and now once.docs/rules/must-use-result.md("A Result kept in a local"), CHANGELOG (#158's entry and a Fixed entry).fixes.rs::a_pack_result_compared_with_undefined_is_not_looked_at(in place!==,null ==, kept, logged).Also carries the merged tree's counts after #157–#161:
work-ceilings.json, andmisses.txt(#160 fixedfar failure-contract namespace-import; #161's newlifetimefixtures add 13missing-mut hoist-constand 2no-param-mutation type-alias; the must-use-result paren text halves with the duplicate gone; oneunbounded-spreadparen text from the new tuples case). Reasons unchanged.Checked locally on this exact tree
cargo nextest run --workspace431/431, full rewrites (blessed, then compared), typecheck, test:std, test:soundness, test:vite, test:docs.🤖 Generated with Claude Code