-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain meaning of Result iters and link to factory functions #38158
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ rollup Thank you! |
📌 Commit b2849c7 has been approved by |
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.
A few things to fix.
@@ -501,6 +501,8 @@ impl<T, E> Result<T, E> { | |||
|
|||
/// Returns an iterator over the possibly contained value. | |||
/// | |||
/// The iterator yields one value if the result is `Ok`, otherwise none. |
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.
Missing Ok
's url.
@@ -520,6 +522,8 @@ impl<T, E> Result<T, E> { | |||
|
|||
/// Returns a mutable iterator over the possibly contained value. | |||
/// | |||
/// The iterator yields one value if the result is `Ok`, otherwise none. |
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.
Missing Ok
's url.
@@ -848,6 +852,8 @@ impl<T, E> IntoIterator for Result<T, E> { | |||
|
|||
/// Returns a consuming iterator over the possibly contained value. | |||
/// | |||
/// The iterator yields one value if the result is `Ok`, otherwise none. |
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.
Missing Ok
's url.
@@ -893,8 +899,13 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> { | |||
|
|||
/// An iterator over a reference to the [`Ok`] variant of a [`Result`]. | |||
/// | |||
/// The iterator yields one value if the result is `Ok`, otherwise none. |
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.
Missing Ok
's url.
/// the [`IntoIterator`] trait). | ||
/// An iterator over the value in a [`Ok`] variant of a [`Result`]. | ||
/// | ||
/// The iterator yields one value if the result is `Ok`, otherwise none. |
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.
Missing Ok
's url.
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.
I'll add them - it wasn't clear to me if the intention is to link every reference...
@bors: r- |
links added, please take another look |
I'm not sure why https://travis-ci.org/rust-lang/rust/jobs/183046022 failed, maybe just a glitch? |
Don't worry, travis build is broken for the moment, so if no error/failed test, it's good. Can you squash your commits please? If you don't know how to do it, take a look here. Once done, ping me and I merge. |
Will do. Should we teach Bors to squash-and-merge? |
Squashed, and rebased to current master. |
@@ -848,6 +856,8 @@ impl<T, E> IntoIterator for Result<T, E> { | |||
|
|||
/// Returns a consuming iterator over the possibly contained value. | |||
/// | |||
/// The iterator yields one value if the result is [`Ok`], otherwise none. |
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.
Otherwise None
(with url).
@@ -501,6 +501,8 @@ impl<T, E> Result<T, E> { | |||
|
|||
/// Returns an iterator over the possibly contained value. | |||
/// | |||
/// The iterator yields one value if the result is [`Ok`], otherwise none. |
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.
Otherwise None
(with url).
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.
Well, no, it doesn't yield None
, it just yields no values at all.
I realize this is implemented by next()
returning None
but I think saying that would only make this confusing. I could rephrase it as "the iterator's next method returns Some of the inner and then None if the result is Ok
, otherwise it returns None." But that seems to be needlessly puncturing the iterator abstraction.
A couple of general comments:
-
There are lots of references to well-known types such as
None
andOk
throughout the code without hyperlinks, indeed even in this very file. If the goal is that every type be manually linked maybe that should go intoCONTRIBUTING.md
to avoid make that clear. IMO it is not so necessary to linkify values the reader is highly likely to already understand, and that anyhow are linked from nearby. -
In my experience repeatedly asking contributors for small incremental changes to a PR that's already an improvement tends to discourage future contributions. My normal practice now is to accept the change and encourage them to send another PR making additional cleanups, and I think this gives them a better feeling about contributing.
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.
No, it returns None
, not "no values at all".
Also, I'm currently finishing to add missing doc examples, then I'll go through all missing urls. None and every other struct/enum/etc... should be linked.
Also, even it seems minor for you, it isn't for me since all these minor things people don't add, I have to after. And it's getting quite huge.
I don't ask it just to bother you or for extreme and dark reasons, it's really because there is a need out of it.
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.
Unless I'm misunderstanding it the iter will either have length 1 and contain the value inside the Ok result, or it will have length zero. It never yields None, unless the result is Ok(None). That's what I was trying to say by it yields 'no values at all'.
https://play.rust-lang.org/?gist=3d6a9500b782e878fae356a08888838b&version=stable&backtrace=0
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.
Ok, I see your point. Confusion on my side. Sorry about that... Therefore, no change is needed.
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.
No problem, I could have been confused myself so I appreciate you checking.
I can send you a little cleanup pr later to linkify other instances. It sure would be nice if we can make it automatic later.
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.
It's been discussed for a while. You can take a look at this issue if you want to take a look at the current status.
@@ -520,6 +524,8 @@ impl<T, E> Result<T, E> { | |||
|
|||
/// Returns a mutable iterator over the possibly contained value. | |||
/// | |||
/// The iterator yields one value if the result is [`Ok`], otherwise none. |
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.
Otherwise None
(with url).
@@ -893,8 +905,13 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> { | |||
|
|||
/// An iterator over a reference to the [`Ok`] variant of a [`Result`]. | |||
/// | |||
/// The iterator yields one value if the result is [`Ok`], otherwise none. |
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.
Otherwise None
(with url).
/// the [`IntoIterator`] trait). | ||
/// An iterator over the value in a [`Ok`] variant of a [`Result`]. | ||
/// | ||
/// The iterator yields one value if the result is [`Ok`], otherwise none. |
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.
Otherwise None
(with url).
@bors: r+ rollup |
📌 Commit 16d4b7b has been approved by |
Explain meaning of Result iters and link to factory functions
Explain meaning of Result iters and link to factory functions
⌛ Testing commit 16d4b7b with merge 02bb808... |
💔 Test failed - auto-win-msvc-64-opt |
@bors: retry |
⌛ Testing commit 16d4b7b with merge f5fa85e... |
💔 Test failed - auto-mac-64-opt-rustbuild |
@bors: retry
…On Fri, Dec 16, 2016 at 7:54 AM, bors ***@***.***> wrote:
💔 Test failed - auto-mac-64-opt-rustbuild
<https://buildbot.rust-lang.org/builders/auto-mac-64-opt-rustbuild/builds/3275>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#38158 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95GmHrclijQ3hIO3cl2XcXETlONVdks5rIrRBgaJpZM4LDokl>
.
|
Explain meaning of Result iters and link to factory functions
@bors retry |
@bors: retry |
Explain meaning of Result iters and link to factory functions
Rollup of 29 pull requests - Successful merges: #37761, #38006, #38131, #38150, #38158, #38171, #38208, #38215, #38236, #38245, #38289, #38302, #38315, #38346, #38388, #38395, #38398, #38418, #38432, #38451, #38463, #38468, #38470, #38471, #38472, #38478, #38486, #38493, #38498 - Failed merges: #38271, #38483
No description provided.