summaryrefslogtreecommitdiff
path: root/tests/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-30 17:01:38 +0100
committerGitHub <noreply@github.com>2022-12-30 17:01:38 +0100
commit80e309f7983bb15c805e86806b3d848aa9cbdfef (patch)
tree1016e367908e889a4ec5754aa2cd2cbca8b96a32 /tests/rustdoc-js-std/parser-errors.js
parentf6cc345be403d481b4518e151218118c2a9eb4bb (diff)
parent588592b78b7a5cc64679b2164f794e79c444d766 (diff)
downloadrust-80e309f7983bb15c805e86806b3d848aa9cbdfef.tar.gz
Rollup merge of #99244 - gthb:doc-improve-iterator-scan, r=m-ou-se
doc: clearer and more correct Iterator::scan The `Iterator::scan` documentation seemed a little misleading to my newcomer eyes, and this tries to address that. * I found “similar to `fold`” unhelpful because (a) the similarity is only that they maintain state between iterations, and (b) the _dissimilarity_ is no less important: one returns a final value and the other an iterator. So this replaces that with “which, like `fold`, holds internal state, but unlike `fold`, produces a new iterator. * I found “the return value from the closure, an `Option`, is yielded by the iterator” to be downright incorrect, because “yielded by the iterator” means “returned by the `next` method wrapped in `Some`”, so this implied that `scan` would convert an input iterator of `T` to an output iterator of `Option<T>`. So this replaces “yielded by the iterator” with “returned by the `next` method” and elaborates: “Thus the closure can return `Some(value)` to yield `value`, or `None` to end the iteration.” * This also changes the example to illustrate the latter point by returning `None` to terminate the iteration early based on `state`.
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions