Skip to content

ref(clippy): Enable tests-outside-test-module lint#2736

Merged
szokeasaurusrex merged 1 commit intomasterfrom
szokeasaurusrex/tests-outside-test-module
Sep 10, 2025
Merged

ref(clippy): Enable tests-outside-test-module lint#2736
szokeasaurusrex merged 1 commit intomasterfrom
szokeasaurusrex/tests-outside-test-module

Conversation

@szokeasaurusrex
Copy link
Copy Markdown
Member

Enable the tests-outside-test-module Clippy lint, and fix violations.

This lint will enforce the convention that #[test] items must be placed within a #[cfg(test)] module.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review September 10, 2025 11:54
@szokeasaurusrex szokeasaurusrex requested a review from a team as a code owner September 10, 2025 11:55
Copy link
Copy Markdown
Member Author

I recommend reviewing this PR with the "hide whitespace differences" option enabled, as most of the diff is just whitespace change

Enable the [`tests-outside-test-module`](https://rust-lang.github.io/rust-clippy/master/index.html#tests_outside_test_module) Clippy lint, and fix violations.

This lint will enforce the convention that `#[test]` items must be placed within a `#[cfg(test)]` module.
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/tests-outside-test-module branch from ae468aa to 409edad Compare September 10, 2025 12:12
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is related to snapshot testing used in this crate (it is called insta in case you are interested).

Since we moved the functions into a different module, the file names need to be updated. For most of the files, it was a simple rename, but for this one, the expression on line 3 appears to have had some changes, so git recognized it as a deletion of this file, and an adding of the file with the new path

Copy link
Copy Markdown
Member

@lcian lcian Sep 10, 2025

Choose a reason for hiding this comment

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

I see, I was wondering why the tests would fail with this.
Yeah I saw insta and I think we should use it in the SDK too, I have an issue here getsentry/sentry-rust#875

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I honestly had no clue what insta was before doing this PR and seeing these failures in CI. We don't use it very widely in Sentry CLI. Maybe we should; although, I admittedly am unsure what it is useful for. I only did the minimal amount of research on it to fix the tests and move on 🤷

Copy link
Copy Markdown
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

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

Looks good!

@szokeasaurusrex szokeasaurusrex merged commit e7574b3 into master Sep 10, 2025
24 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/tests-outside-test-module branch September 10, 2025 12:29
@runningcode
Copy link
Copy Markdown
Contributor

Oh nice, thanks for doing this!

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