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

Run clippy on test code #270

Merged
merged 1 commit into from
Apr 14, 2021
Merged

Run clippy on test code #270

merged 1 commit into from
Apr 14, 2021

Conversation

webmaster128
Copy link
Member

No description provided.

Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Good stuff and thanks to fix the tests below.

Just curious as to the best flags to run clippy with

@@ -868,7 +868,7 @@ jobs:
command: cargo fmt -- --check
- run:
name: Clippy linting on workspace
command: cargo clippy -- -D warnings
command: cargo clippy --tests -- -D warnings
Copy link
Member

Choose a reason for hiding this comment

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

Nice idea. Did you check if this also runs clippy on non-test code (cargo clippy --help doesn't clarify that)

The recommendation from clippy seems to be:

  # if you want the build job to fail when encountering warnings, use
  - cargo clippy -- -D warnings
  # in order to also check tests and non-default crate features, use
  - cargo clippy --all-targets --all-features -- -D warnings

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice find. We cannot use --all-features because of

[features]
backtraces = ["cosmwasm-std/backtraces"]

which only compiles using Rust nightly. But --all-targets is a nice alternative to --tetsts.

@webmaster128 webmaster128 force-pushed the run-clippy-on-test-code branch from cd745b5 to 6b0d106 Compare April 14, 2021 15:25
@webmaster128 webmaster128 merged commit a82b248 into master Apr 14, 2021
@webmaster128 webmaster128 deleted the run-clippy-on-test-code branch April 14, 2021 15:34
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.

2 participants