Skip to content
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

Replace lots of hamcrest's assert_that with a builder style #5929

Merged
merged 7 commits into from
Aug 28, 2018

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Aug 23, 2018

Refs #5742

I've been thinking of possible solutions to close out #5742, so I'm submitting this for early feedback.

@alexcrichton what do you think? If you like the look of this I'll apply it across the suite.

r? @alexcrichton

impl Drop for Execs {
fn drop(&mut self) {
if !self.ran {
// TODO: Re-enable when everything goes through Execs#run
Copy link
Contributor

Choose a reason for hiding this comment

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

Overall I like the direction. mabe add a #[must_use] to Execs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting: ProjectBuilder already has the must_use attribute applied to it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Defence in depth, use both. One checks at runtime the other at compile time.

@alexcrichton
Copy link
Member

Looking good to me! I wonder if we could lift the requirement though of requiring both execs and run? Having both feels slightly redundant (but I think one is good to keep)

@dwijnand
Copy link
Member Author

dwijnand commented Aug 23, 2018

Yeah we can make .cargo return Execs and then forward the ProcessBuilder methods used in the test suite.

How do you feel, instead, about running the assert in the Drop? It would remove the need to expressly execute .run() but maybe it's a bad practice? .run() would still be there when you want to force the execution order. I'm torn 😄

@alexcrichton
Copy link
Member

Sounds plausible to me! (having .cargo return Execs)

I'd be more wary of removing the need for .run() in the sense that having such significant behavior happen in a destructor can be a bit scary for codegen reasons here and there.

@alexcrichton
Copy link
Member

Looks great to me!

@dwijnand dwijnand changed the title [WIP] Replace hamcrest's assert_that with a builder style Replace lots of hamcrest's assert_that with a builder style Aug 28, 2018
@dwijnand
Copy link
Member Author

dwijnand commented Aug 28, 2018

This doesn't completely remove hamcrest, but it does a lot.

I'm concerned that my grand refactorings will clash with parallel development in PRs, so I'd love to land this PR into master and send follow up PRs to close out #5742.

@dwijnand
Copy link
Member Author

Could someone restart AppVeyor please?

@Eh2406
Copy link
Contributor

Eh2406 commented Aug 28, 2018

Closing and reopening will trigger a retest, or pushing more commits.

@dwijnand
Copy link
Member Author

Yeah but both are noisy.

That said my commenting is also noisy so I'm not doing any better..

@dwijnand dwijnand closed this Aug 28, 2018
@dwijnand dwijnand reopened this Aug 28, 2018
@alexcrichton
Copy link
Member

Holy cow, nice! Thanks so much for taking this on!

Let's definitely get this in before it bitrots!

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 28, 2018

📌 Commit 85984a8 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Aug 28, 2018

⌛ Testing commit 85984a8 with merge 9ddf75a...

bors added a commit that referenced this pull request Aug 28, 2018
Replace lots of hamcrest's assert_that with a builder style

Refs #5742

I've been thinking of possible solutions to close out #5742, so I'm submitting this for early feedback.

@alexcrichton what do you think? If you like the look of this I'll apply it across the suite.

r? @alexcrichton
@dwijnand
Copy link
Member Author

Cheers, Alex. 🍻

@bors
Copy link
Contributor

bors commented Aug 28, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 9ddf75a to master...

@bors bors merged commit 85984a8 into rust-lang:master Aug 28, 2018
@dwijnand dwijnand deleted the remove-hamcrest branch August 28, 2018 18:05
@Eh2406
Copy link
Contributor

Eh2406 commented Aug 28, 2018

And another net negative PR. If you keep up with this the project will just disappear. :-P

@ehuss ehuss added this to the 1.30.0 milestone Feb 6, 2022
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