Commit ee9a9f8
committed
Auto merge of #124793 - scottmcm:simplify-as-chunks, r=Nilstrieb
Implement `as_chunks` with `split_at_unchecked`
We were discussing various ways to do [this on Discord](https://discord.com/channels/273534239310479360/273541522815713281/1236946363120619521), and in the process I noticed that <https://rust.godbolt.org/z/1P16P37Go> is emitting a panic path inside `as_chunks`. It optimizes out in release, but we could just not do that in the first place.
We're already doing unsafe code that depends on this value being calculated correctly, so might as well call `split_at_unchecked` instead of `split_at`.1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1337 | 1337 | | |
1338 | 1338 | | |
1339 | 1339 | | |
1340 | | - | |
1341 | | - | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1342 | 1344 | | |
1343 | 1345 | | |
1344 | 1346 | | |
| |||
1487 | 1489 | | |
1488 | 1490 | | |
1489 | 1491 | | |
1490 | | - | |
1491 | | - | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
1492 | 1496 | | |
1493 | 1497 | | |
1494 | 1498 | | |
| |||
0 commit comments