-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix build warning, fail CI if build has warnings #73
base: main
Are you sure you want to change the base?
Conversation
projectgus
commented
May 9, 2024
- Fix a build warning that snuck in with Added impl serde #67 (unused Result).
- Configure CI to fail if the build step produces any warnings.
342a328
to
33d6504
Compare
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.
I think we can get away without using a feature for this
@@ -51,7 +51,7 @@ jobs: | |||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |||
|
|||
- name: Build | |||
run: cargo build --all --verbose | |||
run: cargo build --all --verbose --features strict |
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.
The feature is a neat idea but why not just -D warnings
?
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.
Good question... I originally implemented this by setting RUSTFLAGS=-D warnings
and it looked like it built all of the dependencies with -D warnings
too. (Then I copied the feature approach from here).
I didn't try passing -D directly to cargo though, I will try this and get back to you.
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.
Hey, sorry for the long turnaround on following this up!
- Can set
RUSTFLAGS
but this builds all crate dependencies with deny warnings too, which seems excessive. - Can't pass
-D warnings
directly tocargo build
, only tocargo rustc
- but I think this has the same shortcoming as settingRUSTFLAGS
.
The best summary I've found (with links to some other resources) is the thread linked in the previous comment https://users.rust-lang.org/t/how-to-fail-a-build-with-warnings/2687
33d6504
to
85e329a
Compare
Have rebased this as still think it's potentially useful. As per discussion above I don't know of a neater way to enable this only in CI, but not enable it for dependencies. |