bors [Wed, 18 Dec 2019 20:35:09 +0000 (20:35 +0000)]
Auto merge of #4910 - krishna-veerareddy:issue-1205-cmp-nan-against-consts, r=phansch
Detect comparisons with NAN constants
Currently `cmp_nan` lint doesn't detect comparisons with NaN's if the operands are consts variables so to fix this we evaluate the const variables first before testing for NaN.
changelog: Detect comparisons with NaN constants in `cmp_nan` lint
Currently `cmp_nan` lint doesn't detect comparisons with NaN's
if the operands are consts variables so to fix this we evaluate
the const variables first before testing for NaN.
bors [Thu, 12 Dec 2019 00:34:59 +0000 (00:34 +0000)]
Auto merge of #4883 - krishna-veerareddy:issue-4818-cast-sign-loss-false-positive, r=flip1995
Fix false positive with cast_sign_loss lint
`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.
Fixes #4818 #4764 #4743
changelog: Fix false positives in `cast_sign_loss` lint
bors [Fri, 6 Dec 2019 11:30:43 +0000 (11:30 +0000)]
Auto merge of #4884 - RobbieClarken:warn-missing-errors, r=llogiq
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)]`.
RobbieClarken [Fri, 6 Dec 2019 00:00:23 +0000 (10:30 +1030)]
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 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)]`.
`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.
bors [Thu, 5 Dec 2019 10:33:07 +0000 (10:33 +0000)]
Auto merge of #4880 - daxpedda:string-add, r=phansch
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.
bors [Sun, 1 Dec 2019 00:13:17 +0000 (00:13 +0000)]
Auto merge of #4866 - rust-lang:needful-doctest-main, r=flip1995
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.
bors [Sat, 30 Nov 2019 12:46:30 +0000 (12:46 +0000)]
Auto merge of #4865 - phansch:fix_master_deployment, r=llogiq
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
bors [Fri, 29 Nov 2019 19:48:19 +0000 (19:48 +0000)]
Auto merge of #4588 - phansch:add_custom_ice_hook, r=Manishearth
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`
Philipp Hansch [Fri, 27 Sep 2019 05:09:12 +0000 (07:09 +0200)]
Add custom ICE message that points to Clippy repo
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`
bors [Fri, 29 Nov 2019 19:06:59 +0000 (19:06 +0000)]
Auto merge of #4837 - flip1995:integration, r=phansch
RIIR: Integration tests
In #4825 the `rust-lang/chalk` test failed because the output was too large. I didn't want to completely disabling the output, since showing the backtrace of an ICE directly in travis is pretty useful. Since finding strings in command outputs is easier in Rust, than in bash, I just RIIRed it.
This and also rewriting our tests in Rust may help with trying out new CI platforms (cc #4577)
Philipp Hansch [Fri, 29 Nov 2019 18:51:17 +0000 (19:51 +0100)]
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.
Phil Hansch [Thu, 28 Nov 2019 09:19:05 +0000 (10:19 +0100)]
Rollup merge of #4842 - timbodeit:comparison-chain-false-positive-4827, r=flip1995
[comparison_chain] #4827 Check `core::cmp::Ord` is implemented
Only emit `comparison_chain` lint, if `cmp` is actually available on the type being compared. Don't emit lint in cases where only `PartialOrd` is implemented.
I haven't yet fully understood [Adjustments](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/adjustment/struct.Adjustment.html). I would appreciate, if someone could double check whether my usage of [expr_ty](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TypeckTables.html#method.expr_ty) in `clippy_lints/src/comparison_chain.rs:91` is correct or if there are cases where using [expr_ty_adjusted](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TypeckTables.html#method.expr_ty_adjusted) would lead to a different result when used with `utils::implements_trait`.
---
fixes #4827
changelog: [comparison_chain] Check `core::cmp::Ord` is implemented