Skip to content

Mention that -D warnings will deny ALL warnings, not just clippy warnings #3930

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

Merged
merged 2 commits into from
Apr 11, 2019

Conversation

sunjay
Copy link
Member

@sunjay sunjay commented Apr 8, 2019

If we pass -D warnings to clippy, it causes the build to fail if there are any warnings, even the ones not generated by clippy. This isn't immediately obvious when you're looking at this as someone just setting up clippy, so people might not expect this nor know how to fix it. I've added a few sentences in the README to help anyone who runs into this.

These docs are useful for anyone setting up clippy warnings to be denied during CI, but still otherwise want rustc warnings to be allowed.

I could have also changed -D warnings to -D clippy::all in the Travis configurations themselves, but I wasn't sure what you would prefer to have people use as the default.

@flip1995
Copy link
Member

flip1995 commented Apr 9, 2019

We highly prefer -D warnings in travis. In Rust code you don't want to have any warnings in your crate, since these will lead to bugs.

E.g.

enum Foo {
    A,
    B,
}
//...
match some_foo {
    A => (),
    B => (),
}

will only produce a warning, telling you that B => (), is unreachable, since the first arm is a variable binding. It also suggests that you should use Foo::A instead.

dead_code warnings won't produce bugs like the one above, but if you have to many dead_code warnings in your code, you may miss warnings like the one above. Queue 2h of debugging. Been there, done that 😄


TL;DR: I'm willing to merge this with the typo fixed, but you should prevent any warnings from the rust compiler in production.

Co-Authored-By: sunjay <[email protected]>
@sunjay
Copy link
Member Author

sunjay commented Apr 11, 2019

Typo is fixed! Yes I agree about the warnings in general, but we should still warn/inform people about what we're advising them to do.

Thanks for reviewing this! :)

@flip1995
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 11, 2019

📌 Commit a7bfac7 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Apr 11, 2019

⌛ Testing commit a7bfac7 with merge bad3e08...

bors added a commit that referenced this pull request Apr 11, 2019
Mention that -D warnings will deny ALL warnings, not just clippy warnings

If we pass `-D warnings` to clippy, it causes the build to fail if there are *any* warnings, even the ones not generated by clippy. This isn't immediately obvious when you're looking at this as someone just setting up clippy, so people might not expect this nor know how to fix it. I've added a few sentences in the README to help anyone who runs into this.

These docs are useful for anyone setting up clippy warnings to be denied during CI, but still otherwise want rustc warnings to be allowed.

I could have also changed `-D warnings` to `-D clippy::all` in the Travis configurations themselves, but I wasn't sure what you would prefer to have people use as the default.
@bors
Copy link
Contributor

bors commented Apr 11, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: flip1995
Pushing bad3e08 to master...

@bors bors merged commit a7bfac7 into rust-lang:master Apr 11, 2019
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