-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
libcollections: Add append_all_move method to Vec<T>. #15532
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
Conversation
|
So far we have That said, I'm a bit leery about adding more stuff to Vec that's literally the existing stuff done in a functional style. What's next, a function version of Perhaps it's better to investigate an alternative approach. Once we have by-value closures, I would suggest something like pub fn with(mut self, f: |&mut Vec<T>|) -> Vec<T> {
f(&mut self);
self
}This will abstract away all the mutating methods so they can work in a functional style. So instead of Without by-value closures, this would work for things like that |
This method is like push_all_move, but returns the current vector.
|
I've renamed it to |
|
Hm, a few random thoughts:
|
|
Closing due to in activity, but I think that we'll definitely shake out some conventions for methods like this during API triage. |
…-formatting, r=Veykril
On type format '(', by adding closing ')' automatically
If I understand right, `()` can surround pretty much the same `{}` can, so add another on type formatting pair for convenience: sometimes it's not that pleasant to write parenthesis in `Some(2).map(|i| (i, i+1))` cases and I would prefer r-a to do that for me.
One note: currently, https://github.com/rust-lang/rust-analyzer/blob/b06503b6ec98c9ed44698870cbf3302b8560b442/crates/rust-analyzer/src/handlers/request.rs#L357 fires always.
Should we remove the assertion entirely now, since apparently things work in release despite that check?
) `assign_op_pattern` can be used in a `const` context if the trait definition as well as the implementation of the corresponding `Assign` pattern is `const` as well. The lint was temporarily deactivated in the compiler repository for all `const` contexts to avoid false positives when operators were potentially constified. This reenables it when appropriate now that the repositories have been synced. Closes rust-lang/rust-clippy#15285 changelog: [`assign_op_pattern`]: trigger in `const` contexts when appropriate r? @flip1995
This adds a new method,
append_all_move, to Vec. It's similar topush_all_move, but returns the current vector so it can be used again.