expect_err for Result. #38982

Merged
merged 1 commit into from Jan 14, 2017

Projects

None yet

8 participants

@clarcharr
Contributor

This adds an expect_err method to Result. Considering how unwrap_err already exists, this seems to make sense. Inconsistency noted in Manishearth/rust-clippy#1435.

@rust-highfive
Collaborator

r? @aturon

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

@apasel422 apasel422 added the T-libs label Jan 11, 2017
@aturon
Contributor
aturon commented Jan 11, 2017

cc @rust-lang/libs

This fits conventions and makes sense to me! Before we land, we'll need to open a tracking issue and tag the stability attribute with it.

@alexcrichton
Member

I like it!

+ ///
+ /// Basic usage:
+ ///
+ /// ```{.should_panic}
@durka
durka Jan 11, 2017 Contributor

What is this syntax?

@sfackler
sfackler Jan 11, 2017 Member

It's archaic but equivalent to just should_panic.

@clarcharr
clarcharr Jan 11, 2017 Contributor

TBH I've wondered why you use this instead of just #![should_panic]. I just copied it from expect's docs.

@clarcharr
Contributor

If the general consensus is to merge, I can create a tracking issue and tag it in the PR.

@aturon
Contributor
aturon commented Jan 13, 2017

@clarcharr Let's do it!

@clarcharr clarcharr expect_err for Result.
e520b77
@clarcharr
Contributor

@aturon It is done!

@aturon
Contributor
aturon commented Jan 13, 2017

@bors: r+

Thanks for the PR!

@bors
Contributor
bors commented Jan 13, 2017

📌 Commit e520b77 has been approved by aturon

@bors
Contributor
bors commented Jan 14, 2017

⌛️ Testing commit e520b77 with merge 2f9dedb...

@bors bors added a commit that referenced this pull request Jan 14, 2017
@bors bors Auto merge of #38982 - clarcharr:expect_err, r=aturon
expect_err for Result.

This adds an `expect_err` method to `Result`. Considering how `unwrap_err` already exists, this seems to make sense. Inconsistency noted in Manishearth/rust-clippy#1435.
2f9dedb
@bors
Contributor
bors commented Jan 14, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: aturon
Pushing 2f9dedb to master...

@bors bors merged commit e520b77 into rust-lang:master Jan 14, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@clarcharr clarcharr deleted the clarcharr:expect_err branch Jan 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment