Skip to content

De-closure-ify/remove vec & str .as_{imm,mut}_buf #11029

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

Merged
merged 4 commits into from
Dec 19, 2013

Conversation

huonw
Copy link
Member

@huonw huonw commented Dec 17, 2013

For str.as_mut_buf, un-closure-ification is achieved by outright removal (see commit message). The others are replaced by .as_ptr, .as_mut_ptr and .len

@alexcrichton
Copy link
Member

Nice work!

There's no need for the restrictions of a closure with the above methods.
`.as_mut_buf` was used exactly once, in `.push_char` which could be
written in a simpler way, using the `&mut ~[u8]` that it already
retrieved. In the rare situation when someone really needs
`.as_mut_buf`-like functionality (getting a `*mut u8`), they can go via
`str::raw::as_owned_vec`.
bors added a commit that referenced this pull request Dec 19, 2013
For `str.as_mut_buf`, un-closure-ification is achieved by outright removal (see commit message). The others are replaced by `.as_ptr`, `.as_mut_ptr` and `.len`
@bors bors closed this Dec 19, 2013
@bors bors merged commit b906a8b into rust-lang:master Dec 19, 2013
@huonw huonw deleted the rm-vec-as-buf branch February 25, 2014 05:28
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 31, 2023
Make `comparison_to_empty` work on `if let`/`let` chains

This adds `LetChain` to `clippy_utils::higher`, other lints may benefit from such a change as well :D

changelog: Enhancement: [`comparison_to_empty`]: Now lints on `if let`
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.

3 participants