Add lint for pub fns returning a `Result` without documenting errors
The Rust Book recommends that functions that return a `Result` type have [a doc comment with an `# Errors` section](https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commonly-used-sections) describing the kind of errors that can be returned. This change adds a lint to enforce this. The lint is allow by default; it can be enabled with `#![warn(clippy::missing_errors_doc)]`.
Closes#4854.
changelog: adds lint for `missing_errors_doc`
The Rust Book recommends that functions that return a `Result` type have
a doc comment with an `# Errors` section describing the kind of errors
that can be returned
(https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commonly-used-sections).
This change adds a lint to enforce this. The lint is allow by default;
it can be enabled with `#![warn(clippy::missing_errors_doc)]`.
Closes#4854.
`cast_sign_loss` lint incorrectly suggests that the result of
`checked_abs`, `rem_euclid` and `checked_rem_euclid` cannot
be casted to an unsigned integer without loss.
Fix false positive in `string_add`.
`clippy::string_add` was popping up in macros.
I'm not sure what clippy's general direction is in these matters, but I can change it to be external macros only too.
---
changelog: Fix false positives for `string_add` in macro expansions.
Rustup to rust-lang/rust#66878
I need to sleep now, feel free to pick it up.
The output of the `lint_without_lint_pass` test seems to disappear, I'm not sure why.. :/
changelog: none
Fix FP in manual_swap lint with slice-like types
Fixes#4853
changelog: Fix FP in [`manual_swap`] lint with slice-like types and make it auto applicable
Less needless_doctest_main false positives
This checks if a) the `fn main() {}` function is empty or if the doctest contains a `static`. In both cases don't lint. While this fixes#4858 at the cost of some false negatives, but this seems a better solution than disabling the lint outright. In the long run, using `syn` should solve the issue in the right way.
changelog: none
Fix master deployment
It was failing because it could not find `.github/deploy_key.enc` in the
current directory (`./out`). Switching to the previous directory should
fix the deployment and the master build.
Example Travis log: https://travis-ci.com/rust-lang/rust-clippy/jobs/261688169#L1900
changelog: none
cc @lzutao
Add custom ICE message that points to Clippy repo
changelog: Link to Clippy issue tracker in ICE messages
This utilizes https://github.com/rust-lang/rust/pull/60584 by setting
our own `panic_hook` and pointing to our own issue tracker instead of
the rustc issue tracker.
This also adds a new internal lint to test the ICE message.
**Potential downsides**
* This essentially copies rustc's `report_ice` function as
`report_clippy_ice`. I think that's how it's meant to be implemented, but
maybe @jonas-schievink could have a look as well =)
The downside of more-or-less copying this function is that we have to
maintain it as well now.
The original function can be found [here][original].
* `driver` now depends directly on `rustc` and `rustc_errors`
Closes#2734
[original]: 59367b074f/src/librustc_driver/lib.rs (L1185)