Conversation
This comment has been minimized.
This comment has been minimized.
88ef0cf to
7d88079
Compare
This comment has been minimized.
This comment has been minimized.
9f37d58 to
e62ac74
Compare
|
r? libs |
|
Going to pass this one along. r? libs |
e62ac74 to
62fc4c9
Compare
This comment has been minimized.
This comment has been minimized.
62fc4c9 to
67e3167
Compare
|
@rustbot ready Perhaps a perf run to see if I haven't regressed anything unwittingly? |
| // SAFETY: Nothing else points to or will point to the contents of this slice. | ||
| Some(unsafe { &mut *head }) | ||
| } | ||
| // SAFETY: we have `&mut self`, so are allowed to temporarily materialize a mut slice |
There was a problem hiding this comment.
I'd add that next must not be called if __get_unchecked was called, so invalidating previously returned items does not conflict with TrustedRandomAccess.
There was a problem hiding this comment.
While that is true, I don't see how this particular next method is special in that regard. So would you then like all next methods of iterators that impl TrustedRandomAccess to get such a comment?
67e3167 to
8a668bd
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@joboet Thanks for reviewing so far; your comments have been very helpful! I've removed all uses of overflowing_* and also switched all remaining conditions like |
| if self.v.is_empty() { | ||
| (0, Some(0)) | ||
| } else { | ||
| let n = self.v.len() / self.chunk_size; | ||
| let rem = self.v.len() % self.chunk_size; | ||
| let n = if rem > 0 { n + 1 } else { n }; | ||
| let n = (self.v.len() - 1) / self.chunk_size + 1; | ||
| (n, Some(n)) | ||
| } |
There was a problem hiding this comment.
I changed 4 cases of this manual div_ceil to the real thing..
8a668bd to
b60788e
Compare
|
@bors r+ |
Slice iter cleanup
Rollup of 5 pull requests Successful merges: - #146436 (Slice iter cleanup) - #148250 (array_chunks: slightly improve docs) - #148678 (Merge E0412 into E0425) - #149520 (also introduce Peekable::next_if_map_mut next to next_if_map) - #149538 (std: sys: fs: uefi: Make time in FileAttr optional) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #146436 - hkBst:slice-iter-1, r=joboet Slice iter cleanup
slice iter cleanup: replace checked_sub with saturating_sub Continuation of rust-lang#146436 r? `@joboet`
slice iter cleanup: replace checked_sub with saturating_sub Continuation of rust-lang#146436 r? ``@joboet``
slice iter cleanup: replace checked_sub with saturating_sub Continuation of rust-lang/rust#146436 r? `@joboet`
No description provided.