rust/library/core
Matthias Krüger 50327d2c91
Rollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se
Make split_inclusive() on an empty slice yield an empty output

`[].split_inclusive()` currently yields a single, empty slice. That's
different from `"".split_inslusive()`, which yields no output at
all. I think that makes the slice version harder to use.

The case where I ran into this bug was when writing code for
generating a diff between two slices of bytes. I wanted to prefix
removed lines with "-" and a added lines with "+". Due to
`split_inclusive()`'s current behavior, that means that my code prints
just a "-" or "+" for empty files. I suspect most existing callers
have similar "bugs" (which would be fixed by this patch).

Closes #89716.
2021-12-14 20:47:26 +01:00
..
benches Auto merge of #88788 - falk-hueffner:speedup-int-log10-branchless, r=joshtriplett 2021-10-12 03:18:54 +00:00
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Rollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se 2021-12-14 20:47:26 +01:00
tests Auto merge of #91841 - matthiaskrgr:rollup-zlhsg5a, r=matthiaskrgr 2021-12-13 00:56:18 +00:00
Cargo.toml rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00