Skip to content

Add doctests for keys() and values() of the BTreeMap collection. #19555

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

Merged

Conversation

jbranchaud
Copy link
Contributor

No description provided.

@alexcrichton
Copy link
Member

r? @gankro

/// a.insert(2u, "b");
///
/// let keys: Vec<uint> = a.keys().map(|&x| x).collect();
/// assert_eq!(keys, [1u,2].iter().map(|&x| x).collect());
Copy link
Contributor

Choose a reason for hiding this comment

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

for making keys, I would do a.keys().cloned().collect(). For the vec you use for comparison, I would use vec![1, 2].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make the suggested changes 😸

@jbranchaud
Copy link
Contributor Author

@gankro how does it look now? It looks a lot cleaner to me ✨

@Gankra
Copy link
Contributor

Gankra commented Dec 5, 2014

Looks great!

r=me with squashed commits.

Update keys() and values() for BTreeMap based on @gankro's comments.

Assign keys and values to variables before doing assertion.
@jbranchaud jbranchaud force-pushed the add-doctests-for-key-values-of-btreemap branch from 62ee5d9 to d6b6df0 Compare December 5, 2014 21:43
@jbranchaud
Copy link
Contributor Author

squashed!

bors added a commit that referenced this pull request Dec 8, 2014
@bors bors closed this Dec 8, 2014
@bors bors merged commit d6b6df0 into rust-lang:master Dec 8, 2014
@jbranchaud jbranchaud deleted the add-doctests-for-key-values-of-btreemap branch December 10, 2014 03:41
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 28, 2025
Enable `[canonicalize-issue-links]` and `[no-mentions]` in triagebot
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.

4 participants