mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 02:35:37 +01:00
Replayed over the last 300 merges of main, all-unguarded failed good
pull requests on collections that cannot be empty. It now leaves out:
- plain locals bound to an array type of a positive length, to a
non-empty array literal or vec![...], or to a literal range followed
only by methods that keep an item (map, iter, rev, collect into a
known collection ...); counts may be consts of the file
- locals filled by a push or insert on every pass of a loop over such a
source
- fields and const or static items the file declares only as arrays of
a positive length
- collections compared with a non-empty literal through such methods,
directly or through a local built from them, and assertions on a
local bound to a count or length
- .windows(k) and .chunks_exact(k) when the collection has k items
Later code that may remove items or replace the collection cancels the
exemption.
Only only-weak, self-compare, ignore-without-reason and sleep fail the
check now. The other rules list their hits on changed lines without
failing. On the same 300 merges, 1 would fail (an only-weak test), and
the 3 all-unguarded hits are tests an empty result passes. On main at
07037afda8, all-unguarded lists 392 hits instead of 433.