Skip to content

Suggest adding a #[cfg(test)] to a test module #90197

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

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Oct 23, 2021

closes #88138

@rust-highfive
Copy link
Contributor

r? @wesleywiser

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 23, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 28, 2021
@TaKO8Ki TaKO8Ki requested a review from wesleywiser October 29, 2021 03:22
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Nov 4, 2021

r? @estebank

@rust-highfive rust-highfive assigned estebank and unassigned wesleywiser Nov 4, 2021
@TaKO8Ki TaKO8Ki requested a review from estebank November 7, 2021 11:19
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Nov 10, 2021

Could you review this PR? @wesleywiser @estebank

@wesleywiser
Copy link
Member

Looks good to me. Thanks @TaKO8Ki!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 11, 2021

📌 Commit 3e43de4 has been approved by wesleywiser

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2021
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Nov 11, 2021

@wesleywiser Thank you!

visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
);
let test_module_span = match module_to_string(parent_module) {
Some(module) if module.contains("test") => Some(parent_module.span),
Copy link
Contributor

@rhysd rhysd Nov 11, 2021

Choose a reason for hiding this comment

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

@TaKO8Ki @wesleywiser

If my understanding is correct, this would detect modules like the followings as 'test' module.

mod fastest_search {
  // ...
}
mod sohrtest_path {
  // ...
}
mod bytestring {
  // ...
}

Is it intentional? I'm afraid that this loose check causes many false positives. I'd recommend to check more strictly like module == "test" || module == "tests".

Copy link
Member Author

Choose a reason for hiding this comment

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

@wesleywiser I fixed this false positive. Could you review again?

Copy link
Contributor

Choose a reason for hiding this comment

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

As of c597dc8, it looks good to me 👍

@TaKO8Ki TaKO8Ki requested a review from wesleywiser November 11, 2021 05:48
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Nov 11, 2021

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 11, 2021
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Nov 19, 2021

Could you review this PR again? @wesleywiser

@TaKO8Ki TaKO8Ki requested review from estebank and removed request for estebank December 4, 2021 12:42
@TaKO8Ki TaKO8Ki closed this Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unused import warning in a test could suggest #[cfg(test)]
8 participants