Skip to content

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

Merged
bors merged 7 commits into
rust-lang:masterfrom
dwijnand:remove-hamcrest
Aug 28, 2018
Merged

Replace lots of hamcrest's assert_that with a builder style#5929
bors merged 7 commits into
rust-lang:masterfrom
dwijnand:remove-hamcrest

Conversation

@dwijnand

@dwijnand dwijnand commented Aug 23, 2018

Copy link
Copy Markdown
Contributor

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

Comment thread tests/testsuite/support/mod.rs Outdated

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
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

dwijnand commented Aug 23, 2018

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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

dwijnand commented Aug 28, 2018

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

Could someone restart AppVeyor please?

@Eh2406

Eh2406 commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

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

@dwijnand

Copy link
Copy Markdown
Contributor 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
Copy Markdown
Member

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

Let's definitely get this in before it bitrots!

@bors: r+

@bors

bors commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

📌 Commit 85984a8 has been approved by alexcrichton

@bors

bors commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

⌛ 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
Copy Markdown
Contributor Author

Cheers, Alex. 🍻

@bors

bors commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

☀️ 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

Eh2406 commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

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