tokio-rs / bytes

Utilities for working with bytes
MIT License
1.86k stars 278 forks source link

Improve BytesMut::split suggestion #699

Closed paolobarbolini closed 4 months ago

paolobarbolini commented 4 months ago

Incorporates the improvement from #698 into the must_use suggestion of BytesMut::split.

paolobarbolini commented 4 months ago

You know, this makes me realize that advance could be simplified to call clear instead of set_len(0).

Yeah I had skipped clear because it can't avoid the branch inside truncate, but I guess if that was a real problem it could be solved within clear itself.