Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLibz blitz/use question mark instead of unwrap in examples #141
Conversation
muzikmoe
added some commits
Oct 25, 2017
KodrAus
reviewed
Oct 25, 2017
src/lib.rs
Outdated
| //! | ||
| //! let mut bugfix_release = Version::parse("1.0.0").unwrap(); | ||
| //! bugfix_release.increment_patch(); | ||
| //! fn try_increment_patch() -> Result<(), Box<Error>> { |
This comment has been minimized.
This comment has been minimized.
KodrAus
Oct 25, 2017
I think we should hide the main function and signature of try_increment_patch so there's less noise in the examples. You can do this by adding a # at the start of a doc test line. Like:
//! # try_main() -> Result<(), Box<Error>> {
//! let mut bugfix_release = Version::parse("1.0.0")?;
//! ...
//! # Ok(())
//! # }
//! # fn main() { try_main().unwrap(); }
That way you only see the body of the try_main function, but the ? magically works.
src/lib.rs
Outdated
| //! use std::error::Error; | ||
| //! | ||
| //! fn try_compare() -> Result<(), Box<Error>> { | ||
| //! |
This comment has been minimized.
This comment has been minimized.
KodrAus
Oct 25, 2017
This is a bit of a bit, but once we hide the method signatures in this example we'll need to remove this newline, otherwise the docs will have an empty line in them too.
muzikmoe
referenced this pull request
Oct 26, 2017
Open
libz blitz: use question mark instead of unwrap in examples #144
This comment has been minimized.
This comment has been minimized.
|
rebased. |
muzikmoe
closed this
Oct 26, 2017
muzikmoe
deleted the
muzikmoe:libz_blitz/Use_question_mark_instead_of_unwrap_in_examples
branch
Oct 26, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
muzikmoe commentedOct 25, 2017
Should resolve #129