-
Notifications
You must be signed in to change notification settings - Fork 13.4k
reuse capacity
variable in slice::repeat
#67576
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
53c14ce
to
3c56a65
Compare
@bors r+ rollup |
📌 Commit 3c56a65 has been approved by |
🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened |
@@ -487,8 +488,7 @@ impl<T> [T] { | |||
rem_len, | |||
); | |||
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment necessary?
reuse `capacity` variable in slice::repeat None
@@ -450,7 +450,8 @@ impl<T> [T] { | |||
// and `rem` is the remaining part of `n`. | |||
|
|||
// Using `Vec` to access `set_len()`. | |||
let mut buf = Vec::with_capacity(self.len().checked_mul(n).expect("capacity overflow")); | |||
let capacity = self.len().checked_mul(n).expect("capacity overflow"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let capacity = self.len().checked_mul(n).expect("capacity overflow"); | |
let result_len = self.len().checked_mul(n).expect("length overflow in <[T]>::repeat"); |
reuse `capacity` variable in slice::repeat None
reuse `capacity` variable in slice::repeat None
Rollup of 6 pull requests Successful merges: - #67576 (reuse `capacity` variable in slice::repeat) - #67598 (Fix ICE / miscompilation when inlining simd shuffle intrinsic in MIR.) - #67602 (Use issue = "none" instead of "0" in intrinsics) - #67604 (Add Scalar::to_(u|i)16 methods) - #67605 (tidy: change msdn links to newer locations) - #67617 (Remove `compiler_builtins_lib` documentation) Failed merges: r? @ghost
reuse `capacity` variable in slice::repeat None
reuse `capacity` variable in slice::repeat None
Rollup of 12 pull requests Successful merges: - #67112 (Refactor expression parsing thoroughly) - #67192 (Various const eval and pattern matching ICE fixes) - #67287 (typeck: note other end-point when checking range pats) - #67459 (prune ill-conceived BTreeMap iter_mut assertion and test its mutability) - #67576 (reuse `capacity` variable in slice::repeat) - #67602 (Use issue = "none" instead of "0" in intrinsics) - #67614 (Set callbacks globally) - #67617 (Remove `compiler_builtins_lib` documentation) - #67629 (Remove redundant link texts) - #67632 (Convert collapsed to shortcut reference links) - #67633 (Update .mailmap) - #67635 (Document safety of Path casting) Failed merges: r? @ghost
reuse `capacity` variable in slice::repeat None
reuse `capacity` variable in slice::repeat None
Rollup of 15 pull requests Successful merges: - #65244 (add IntoFuture trait and support for await) - #67576 (reuse `capacity` variable in slice::repeat) - #67588 (Use NonNull in slice::Iter and slice::IterMut.) - #67594 (Update libc to 0.2.66) - #67602 (Use issue = "none" instead of "0" in intrinsics) - #67604 (Add Scalar::to_(u|i)16 methods) - #67617 (Remove `compiler_builtins_lib` documentation) - #67621 (Use the correct type for static qualifs) - #67629 (Remove redundant link texts) - #67632 (Convert collapsed to shortcut reference links) - #67633 (Update .mailmap) - #67635 (Document safety of Path casting) - #67654 (Add regression test for old NLL ICE) - #67659 (Stabilize the `matches!` macro) - #67664 (Fix some mailmap entries) Failed merges: r? @ghost
No description provided.