Documentation of Iterator flatten()
improvement
#82687
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-iterators
Area: Iterators
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
While linting my code I came across
manual_flatten
which was triggered in my code.This suggests the change from:
Into:
Both are valid code with same result.
But the rust docs on
flatten()
does not state that this is expected behavior. Yes, this is stated here.But this was not strait forward (in my opinion) to find. It took me writing a whole bug report and looking a bunch of thing up to figure this out. (and I'm not even new to Rust anymore)
I would suggest adding some example code to make his explicit. Here is a suggestion:
(after the "Mapping and then flattening:
<code>...</code>
" section)(or something similar)
This makes both this behavior cleared, easier to find and exposes people to code like this so they are less surprised if clippy starts warning them.
It looks like this behavior might be more common in the future too.
rust-lang/rust-clippy#6061
rust-lang/rust-clippy#6676
The text was updated successfully, but these errors were encountered: