Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve BytesMut::split suggestion #699

Merged
merged 1 commit into from
Apr 25, 2024
Merged

Improve BytesMut::split suggestion #699

merged 1 commit into from
Apr 25, 2024

Conversation

paolobarbolini
Copy link
Contributor

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

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Darksonn Darksonn merged commit a8806c2 into tokio-rs:master Apr 25, 2024
15 checks passed
@paolobarbolini
Copy link
Contributor Author

paolobarbolini commented Apr 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants