-
Notifications
You must be signed in to change notification settings - Fork 72
Make compilation to fail on warnings #1104
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
base: master
Are you sure you want to change the base?
Make compilation to fail on warnings #1104
Conversation
fe3610d to
1ffaa0c
Compare
|
This will be kept until compilation warnings are fixed in |
a3b1702 to
6da554c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
5a00dd1 to
0672ac6
Compare
0672ac6 to
18e6de8
Compare
18e6de8 to
6644542
Compare
db03739 to
dede790
Compare
dede790 to
c7f35d2
Compare
Signed-off-by: Sergio Arroutbi <[email protected]>
c7f35d2 to
6ac9052
Compare
The new workflow runs on every push and pull request to the master branch and performs the following checks:
Both steps are executed with the
RUSTFLAGS="-D warnings"environment variable. This flag instructs the Rust compiler to treat all warnings as fatal errors, which will cause the build to fail if any warnings are present. This helps prevent latent bugs and ensures the code base remains clean.These are some reasons to enforce a "No Warnings" Policy:
Future-Proofing Code: A warning in the current version of a compiler might become a hard error in a future version. Code that compiles with warnings today may fail to compile tomorrow after a simple rustup update, causing unexpected build failures. Enforcing a "no warnings" policy ensures your code is robust against compiler updates.
Preventing Latent Bugs: Many warnings are not just stylistic suggestions; they often point to subtle logical flaws, potential null pointer dereferences, race conditions, or undefined behavior. A classic example is an "unused variable" warning, which can indicate that a necessary calculation was performed but its result was never used.
Improving Code Readability and Reducing Noise: When a build produces dozens of warnings, developers become desensitized to them. This "warning fatigue" can cause them to miss a new, critical warning that appears among the noise. A clean, warning-free build ensures that any new message from the compiler gets immediate attention.
Maintaining a Culture of Quality: A strict "no warnings" policy sets a high standard for the team. It encourages developers to write clean, precise, and intentional code, fostering a culture where quality is not negotiable.