Uh oh!
There was an error while loading. Please reload this page.
std: Add Vec::from_iter comment - #22394
Conversation
rust-highfive
commented
Feb 16, 2015
r? @gankro (rust_highfive has picked a reviewer for you, use r? to override) |
brson
commented
Feb 16, 2015
@bors: r+ 42053 rollup y'all |
There was a problem hiding this comment.
FWIW, I'm not super keen on this fuse approach. In general it adds a check to every next call, to protect against a case that is basically "unspecified behaviour" anyway (the iterator being shorter than its stated size_hint).
I'd prefer adding a check after the loop:
// the iterator ran out of elements before filling the whole vector, so we're done.if vector.len() < vector.capacity(){return vector }since that is guaranteed to be only a single check and outside the inner loop, even if the optimiser can't remove it.
There was a problem hiding this comment.
Good idea! I have updated and added an appropriate comment as well.
… r=brson Requested by Niko in rust-lang#22200 (and is good to have anyway)
… r=brson Requested by Niko in rust-lang#22200 (and is good to have anyway)
f8251e7 to
bebfa78Comparealexcrichton
commented
Feb 17, 2015
It appears this landed in a rollup but then wasn't auto-closed. re-r? @huonw |
huonw
commented
Feb 17, 2015
r=me with the speeling fix. |
bebfa78 to
95a28c9Comparealexcrichton
commented
Feb 17, 2015
Requested by Niko in rust-lang#22200 (and is good to have anyway)
Requested by Niko in rust-lang#22200 (and is good to have anyway)
Requested by Niko in #22200 (and is good to have anyway)