Skip to content
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

Add dedicated docstrings to Sum/Product impl of Result #42570

Merged
merged 1 commit into from
Jun 12, 2017

Conversation

birkenfeld
Copy link
Contributor

(and fix a minor grammar typo below)

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@Mark-Simulacrum
Copy link
Member

r? @frewsxcv -- documentation PR

@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 11, 2017
/// elements are taken, and the `Err` is returned. Should no `Err` occur,
/// the sum of all elements is returned.
///
/// Here is an example which sums up every integer in a vector,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per rust-lang/rfcs#1574, there should be an # Examples line before this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

/// if x < 0 { Err("Negative element found") }
/// else { Ok(x) }
/// ).sum();
/// assert!(res == Ok(3));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_eq!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

/// let v = vec![1, 2];
/// let res: Result<i32, &'static str> = v.iter().map(|&x: &i32|
/// if x < 0 { Err("Negative element found") }
/// else { Ok(x) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your change from https://github.com/rust-lang/rust/pull/42569/files could be copied here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it's not so easy to apply here. Suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you're right, nevermind

(and fix a minor grammar typo below)
@frewsxcv
Copy link
Member

@bors r+ rollup

Thanks!

@bors
Copy link
Contributor

bors commented Jun 12, 2017

📌 Commit 2366c46 has been approved by frewsxcv

@bors
Copy link
Contributor

bors commented Jun 12, 2017

⌛ Testing commit 2366c46 with merge 5aa3403...

bors added a commit that referenced this pull request Jun 12, 2017
Add dedicated docstrings to Sum/Product impl of Result

(and fix a minor grammar typo below)
@bors
Copy link
Contributor

bors commented Jun 12, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: frewsxcv
Pushing 5aa3403 to master...

@bors bors merged commit 2366c46 into rust-lang:master Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants