Skip to content

Make all tests functions and structs crate-private #2735

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

Closed
wants to merge 1 commit into from

Conversation

0xPoe
Copy link
Member

@0xPoe 0xPoe commented Apr 26, 2021

part of #2730

@0xPoe
Copy link
Member Author

0xPoe commented Apr 26, 2021

I found a lot of methods and variables that are not being used, should I remove them all?

cc: @kinnison @rbtcollins

@0xPoe 0xPoe force-pushed the rustin-patch-cleanup branch from cc1a437 to 3192949 Compare April 26, 2021 07:42
@0xPoe
Copy link
Member Author

0xPoe commented Apr 26, 2021

/hold

Waiting for anyhow wroks laned.

@0xPoe 0xPoe force-pushed the rustin-patch-cleanup branch from 3192949 to 9cb5b52 Compare May 1, 2021 03:07
@0xPoe
Copy link
Member Author

0xPoe commented May 1, 2021

/unhold

I think it's ready for review.

@kinnison
Copy link
Contributor

kinnison commented May 7, 2021

I'm not entirely sure if this is valuable here. The way our tests are structured makes it quite hard to know for sure about which bits are used in which test files. Also pub of any kind inside test-$foo.rs seems a little odd to me anyway.

I'm going to defer to @rbtcollins for this particular PR.

@0xPoe
Copy link
Member Author

0xPoe commented May 18, 2021

Because our test is a standalone crate, it warns on cargo check, but not on cargo clippy.

I don't have too good a solution for it.

@kinnison
Copy link
Contributor

I wonder if, instead, what we need is to restructure our tests/ dir into tests/dist.rs and tests/cli.rs with clitools/ and clitests/ as subdirs - i.e. build the dist tests (which import the rustup module) and the cli tests as two integration binaries rather than the nearly 10 we have now. Then the clitools stuff becomes a module used by only one binary (the cli tests) and as such controlling unused functions etc. becomes much more plausible. If we did that though, we'd need to be sure that we'd bottomed the potentially dodgy parallelism in some of the tests.

/// Where we put the rustup / rustc / cargo bins
pub exedir: PathBuf,
pub(crate) exedir: PathBuf,
Copy link
Contributor

Choose a reason for hiding this comment

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

we shouldn't do this - just the pub(crate) on the struct, per our discussions and that bug.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, if we remove the modifier, it will be private. The bug fixed is the use of pub in pub(crate).

Copy link
Member Author

Choose a reason for hiding this comment

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

Could this be another bug?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not suggesting private, I'm suggesting simple pub

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, you mean in this case we don't need to change it to pub(crate) but keep it pub?

@rbtcollins
Copy link
Contributor

rbtcollins commented May 31, 2021 via email

@0xPoe
Copy link
Member Author

0xPoe commented Jun 16, 2021

Close it for now, as it causes cargo check to misrepresent a lot of unused warnings. It can be very disruptive until we can sort out and re-architect the tests.

@0xPoe 0xPoe closed this Jun 16, 2021
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.

3 participants