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

New clippy lint in Rust 1.71.0, items_after_test_module, affecting integration tests #126

Closed
brooksprumo opened this issue Jul 14, 2023 · 3 comments

Comments

@brooksprumo
Copy link

Hi folks!

Looks like Rust 1.71.0 added a new lint1 to Clippy that seem to be affecting test-case. Here's output from one:

warning: items were found after the testing module
   --> core/tests/epoch_accounts_hash.rs:253:1
    |
253 |   #[test_case(TestEnvironment::new()                      ; "without snapshots")]
    |   ^------------------------------------------------------------------------------
    |   |
    |  _in this procedural macro expansion
    | |
254 | | #[test_case(TestEnvironment::new_with_snapshots(80, 40) ; "with snapshots")]
255 | | fn test_epoch_accounts_hash_basic(test_environment: TestEnvironment) {
256 | |     solana_logger::setup();
...   |
664 | |     }
665 | | }
    | |_^
    |
    = help: move the items to before the testing module was defined
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_test_module
    = note: `#[warn(clippy::items_after_test_module)]` on by default
    = note: this warning originates in the attribute macro `test_case` (in Nightly builds, run with -Z macro-backtrace for more info)

This seems to affect integration tests (ones in the tests directory) and not unit tests. As a work-around, I can #[allow] the clippy lint, but wasn't sure if there was something else I could do also.

Let me know if you'd like more information and/or steps to reproduce. Thanks in advance!

Footnotes

  1. https://rust-lang.github.io/rust-clippy/master/index.html#/items_after_test_module

@frondeus
Copy link
Owner

Hi!

This seems to be related - I thought it was already fixed on clippy side
#122

@frondeus
Copy link
Owner

Okay it seems that the fix on the clippy side didn't make to 1.71.0 release and should be released with 1.72 :)

@brooksprumo
Copy link
Author

Thanks for the prompt replies, and additional info! I'll close this issue as it appears resolved to me.

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

No branches or pull requests

2 participants