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

Name of Buf::to_bytes does not follow self conventions #398

Closed
mzabaluev opened this issue Jun 16, 2020 · 2 comments
Closed

Name of Buf::to_bytes does not follow self conventions #398

mzabaluev opened this issue Jun 16, 2020 · 2 comments
Milestone

Comments

@mzabaluev
Copy link
Contributor

mzabaluev commented Jun 16, 2020

An inherent method with the signature of Buf::to_bytes would not pass clippy:

methods called to_* usually take self by reference; consider choosing a less ambiguous name
help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

In the next breaking release, consider renaming the method or maybe replace it with #129 (though less deceptively named than copy_to_bytes).

@seanmonstar
Copy link
Member

Hm, it is true it doesn't follow that convention (though I don't think that's too big a deal in itself). I don't think of any convenient other names that explain what it does. Possibly something like take_bytes or take_into_bytes
...

@carllerche carllerche added this to the v0.6 milestone Oct 16, 2020
carllerche added a commit that referenced this issue Oct 20, 2020
This method replaces `Buf::to_bytes()`, providing a method that copies a
subset of the remaining buffer into a `Bytes` value. As this is strictly
more flexible, `to_bytes()` is removed.

Fixes: #129, #398
carllerche added a commit that referenced this issue Oct 20, 2020
This method replaces `Buf::to_bytes()`, providing a method that copies a
subset of the remaining buffer into a `Bytes` value. As this is strictly
more flexible, `to_bytes()` is removed.

Fixes: #129, #398
carllerche added a commit that referenced this issue Oct 20, 2020
This method replaces `Buf::to_bytes()`, providing a method that copies a
subset of the remaining buffer into a `Bytes` value. As this is strictly
more flexible, `to_bytes()` is removed.

Fixes: #129, #398
@taiki-e
Copy link
Member

taiki-e commented Oct 27, 2020

Fixed by #439

@taiki-e taiki-e closed this as completed Oct 27, 2020
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

No branches or pull requests

4 participants