Skip to content

Don't nudge people towards toilet closures when producing owl results #4313

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
Jul 31, 2019

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Jul 31, 2019

.map_err(drop) should never be linted since sometimes you want to produce Result<(), ()> and the alternative is .map_err(|_| ()), which can be ugly. We don't seem to, but it's good to specifically test for this.

changelog: none

r? @yaahallo

@Manishearth Manishearth changed the title (test) Don't nudge people towards toilet closures when producing owl results Don't nudge people towards toilet closures when producing owl results Jul 31, 2019
@Manishearth
Copy link
Member Author

@bors delegate=yaahallo

@bors
Copy link
Contributor

bors commented Jul 31, 2019

✌️ @yaahallo can now approve this pull request

@@ -55,3 +55,18 @@ fn test_similarly_named_function() {
forget(&SomeStruct); //OK; call to unrelated function which happens to have the same name
std::mem::forget(&SomeStruct);
}

#[allow(dead_code)]
fn test_owl_closure() -> Result<(), ()> {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this should be restricted only to owl results instead of all result types with either their ok or err types equal to ()

@Manishearth Manishearth force-pushed the owl branch 3 times, most recently from 9e96299 to b2bdff4 Compare July 31, 2019 16:04
@yaahc
Copy link
Member

yaahc commented Jul 31, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jul 31, 2019

📌 Commit b2bdff4 has been approved by yaahallo

fn test_owl_result_2() -> Result<u8, ()> {
#[derive(Copy, Clone)]
pub struct Error;
fn produce_result() -> Result<(), Error> {
Copy link
Member

Choose a reason for hiding this comment

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

This function is never used. Is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

whoops

Copy link
Member Author

Choose a reason for hiding this comment

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

Made some last minute refactorings that left this behind

@Manishearth
Copy link
Member Author

@bors r=yaahallo

@bors
Copy link
Contributor

bors commented Jul 31, 2019

📌 Commit 38e7bd2 has been approved by yaahallo

bors added a commit that referenced this pull request Jul 31, 2019
Don't nudge people towards toilet closures when producing owl results

`.map_err(drop)` should never be linted since sometimes you want to produce `Result<(), ()>` and the alternative is `.map_err(|_| ())`, which can be ugly. We don't seem to, but it's good to specifically test for this.

r? @yaahallo
@bors
Copy link
Contributor

bors commented Jul 31, 2019

⌛ Testing commit 38e7bd2 with merge 0aedcce...

@bors
Copy link
Contributor

bors commented Jul 31, 2019

💔 Test failed - checks-travis

@Manishearth
Copy link
Member Author

@bors r=yaahallo

forgot changelog

@bors
Copy link
Contributor

bors commented Jul 31, 2019

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors
Copy link
Contributor

bors commented Jul 31, 2019

📌 Commit 38e7bd2 has been approved by yaahallo

@bors
Copy link
Contributor

bors commented Jul 31, 2019

⌛ Testing commit 38e7bd2 with merge d1b4fc9...

bors added a commit that referenced this pull request Jul 31, 2019
Don't nudge people towards toilet closures when producing owl results

`.map_err(drop)` should never be linted since sometimes you want to produce `Result<(), ()>` and the alternative is `.map_err(|_| ())`, which can be ugly. We don't seem to, but it's good to specifically test for this.

changelog: none

r? @yaahallo
@bors
Copy link
Contributor

bors commented Jul 31, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: yaahallo
Pushing d1b4fc9 to master...

@bors bors merged commit 38e7bd2 into rust-lang:master Jul 31, 2019
@Manishearth Manishearth deleted the owl branch July 31, 2019 19:58
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