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

Sliceext examples #21625

Merged
merged 2 commits into from
Jan 28, 2015
Merged

Sliceext examples #21625

merged 2 commits into from
Jan 28, 2015

Conversation

carols10cents
Copy link
Member

Hi! I added some examples to some stable SliceExt methods that didn't have any.

I'm looking forward to feedback and I'm happy to change anything-- it looks like the doc conventions are still a bit in flux, based on the discussions going on in rfc 505.

I was most unsure about examples for methods that return iterators over slices... I wanted to use asserts on the result of calling .next() like in this permutations example, but then it gets all cluttered up with lifetime stuff... so I went with iterating and printing and mentioning what the expected printed output is like in this chunks example... any ideas for the best ways to do this are appreciated.

Thank you! ❤️

@rust-highfive
Copy link
Collaborator

r? @brson

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

@carols10cents
Copy link
Member Author

Also, I tried running make check but I'm running into this issue. I ran all the code I added manually though...

@carols10cents
Copy link
Member Author

make tips helped me find make check-docs! running that now :)

@carols10cents
Copy link
Member Author

Yay that worked! Let me know if I should do anything else :)

/// let v = [10i32, 40, 30, 20, 50];
/// let (v1, v2) = v.split_at(2);
/// assert!(v1 == [10, 40]);
/// assert!(v2 == [30, 20, 50]);
Copy link
Member

Choose a reason for hiding this comment

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

I think these should be assert_eq

@carols10cents
Copy link
Member Author

All fixed! Thank you for the feedback-- I changed to assert_eq and was able to remove the i32 from all but the empty slices :)

r? @steveklabnik @alexcrichton

@rust-highfive rust-highfive assigned steveklabnik and unassigned brson Jan 27, 2015
@alexcrichton
Copy link
Member

@bors: r+ edb2d8d rollup

thanks!

@bors
Copy link
Contributor

bors commented Jan 27, 2015

🙀 You have the wrong number! Please try again with ebd2d8d.

@alexcrichton
Copy link
Member

@bors: r+ ebd2d8d rollup

barosl added a commit to barosl/rust that referenced this pull request Jan 27, 2015
…alexcrichton

Hi! I added some examples to some stable SliceExt methods that didn't have any.

I'm looking forward to feedback and I'm happy to change anything-- it looks like the doc conventions are still a bit in flux, based on the discussions going on in [rfc 505](rust-lang/rfcs#505).

I was most unsure about examples for methods that return iterators over slices... I wanted to use asserts on the result of calling `.next()` like in [this permutations example](https://github.com/carols10cents/rust/blob/804c1446b3b0afd84851339d8ee2be1dca8f7713/src/libcollections/slice.rs#L608-L617), but then it gets all cluttered up with lifetime stuff... so I went with iterating and printing and mentioning what the expected printed output is like in [this chunks example](https://github.com/carols10cents/rust/blob/804c1446b3b0afd84851339d8ee2be1dca8f7713/src/libcollections/slice.rs#L297-L304)... any ideas for the best ways to do this are appreciated.

Thank you! ❤️
Manishearth added a commit to Manishearth/rust that referenced this pull request Jan 27, 2015
…alexcrichton

Hi! I added some examples to some SliceExt methods that didn't have any.

I'm looking forward to feedback and I'm happy to change anything-- it looks like the doc conventions are still a bit in flux, based on the discussions going on in [rfc 505](rust-lang/rfcs#505).

I was most unsure about examples for methods that return iterators over slices... I wanted to use asserts on the result of calling `.next()` like in [this permutations example](https://github.com/carols10cents/rust/blob/804c1446b3b0afd84851339d8ee2be1dca8f7713/src/libcollections/slice.rs#L608-L617), but then it gets all cluttered up with lifetime stuff... so I went with iterating and printing and mentioning what the expected printed output is like in [this chunks example](https://github.com/carols10cents/rust/blob/804c1446b3b0afd84851339d8ee2be1dca8f7713/src/libcollections/slice.rs#L297-L304)... any ideas for the best ways to do this are appreciated.

Thank you! ❤️
@bors bors merged commit ebd2d8d into rust-lang:master Jan 28, 2015
@carols10cents carols10cents deleted the sliceext-examples branch May 8, 2015 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants