Skip to content

Add a doctest for the btreemap's entry method. #20134

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
merged 1 commit into from
Dec 23, 2014

Conversation

jbranchaud
Copy link
Contributor

This is an updated version of #19711. The merge and subsequent rebase on that branch were more trouble than they were worth, so I am just resubmitting the relevant change here.

If this PR is accepted, then #19711 can be closed.

/cc @gankro

@rust-highfive
Copy link
Contributor

r? @alexcrichton

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

/// },
/// }
/// }
/// ```
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add an assert for e.g. the count of "a"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gankro Is it appropriate to do something as simple as:

assert_eq!(*count.get("a").unwrap(), 3u);

Copy link
Member

Choose a reason for hiding this comment

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

You should be able to even do:

assert_eq!(count["a"], 3);

Make some updates to the entry doctest.
@jbranchaud jbranchaud force-pushed the add-doctest-for-btreemap-entry branch from ee7701a to e8fcbfb Compare December 22, 2014 18:13
@jbranchaud
Copy link
Contributor Author

Thanks for the feedback! Updated.

/// }
/// }
///
/// assert_eq!(count["a"], 3u);
Copy link
Contributor

Choose a reason for hiding this comment

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

Either this u can be omitted, or the whole type of count can-- I think. Your call.

@Gankra
Copy link
Contributor

Gankra commented Dec 22, 2014

Oh heh, should've refreshed the whole PR.

No worries, not actually a big deal. :)

Thanks!

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 22, 2014
…entry

This is an updated version of rust-lang#19711. The merge and subsequent rebase on that branch were more trouble than they were worth, so I am just resubmitting the relevant change here.

If this PR is accepted, then rust-lang#19711 can be closed.

/cc @gankro
@bors bors merged commit e8fcbfb into rust-lang:master Dec 23, 2014
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.

5 participants