-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Suggest adding a #[cfg(test)]
to to a test module
#91770
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
#[cfg(test)]
to to a test module#[cfg(test)]
to to a test module
help: consider adding a `#[cfg(test)]` to the parent module | ||
--> $DIR/unused-imports-in-test-module.rs:8:1 | ||
| | ||
LL | mod test { | ||
| ^^^^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it'd be good to add tests for out-of-line modules too (i.e,, mod test;
). But I'm not sure how feasible it is to test that.
This looks great to me. I posted one comment about the proposed diagnostic message; with that changed, r=me. |
e343965
to
4103248
Compare
Also, please squash your commits if you can :) |
remove a empty line import `module_to_string` use `contains("test")` show a suggestion in case module starts_with/ends_with "test" replace `parent` with `containing`
4103248
to
6f8ad6d
Compare
@bors r=joshtriplett |
📌 Commit 6f8ad6d has been approved by |
⌛ Testing commit 6f8ad6d with merge e6c58674ebb4b3aeded006ee47526f6ec77d97e0... |
💔 Test failed - checks-actions |
@bors retry docker.io 503 |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90345 (Stabilise entry_insert) - rust-lang#91412 (Improve suggestions for importing out-of-scope traits reexported as `_`) - rust-lang#91770 (Suggest adding a `#[cfg(test)]` to to a test module) - rust-lang#91823 (Make `PTR::as_ref` and similar methods `const`.) - rust-lang#92127 (Move duplicates removal when generating results instead of when displaying them) - rust-lang#92129 (JoinHandle docs: add missing 'the') - rust-lang#92131 (Sync rustc_codegen_cranelift) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…-add-cfg-test, r=cjgillot Omit unnecessary help to add `#[cfg(test)]` when already annotated Closes: rust-lang#96611 The related PR is: rust-lang#91770
…ler-errors Add `#[test]` to functions in test modules I implemented a suggestion in rust-lang#91770, but the ui test I created was inadequate and I have fixed that.
closes #88138