Commit Graph

7306 Commits

Author SHA1 Message Date
Krishna Veera Reddy
460d5a3b5a Prevent cmp_nan when inside constants
`std::{f32,f64}::is_nan` isn't a const fn so prevent `cmp_nan`
lint from running within constant comparisons.
2019-12-17 19:18:42 -08:00
Krishna Veera Reddy
eb0408ea65 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.
2019-12-17 18:51:30 -08:00
bors
c62396dbf4 Auto merge of #4907 - krishna-veerareddy:fix-clippy-build, r=phansch
Fix clippy build failure

Clippy build fails because the feature `result_map_or` has been stabilized in v1.41.0 but we still have an explicit feature attribute for it.

changelog: none
2019-12-17 09:00:51 +00:00
Krishna Veera Reddy
728a2418cb Fix clippy build failure
Clippy build fails because the feature `result_map_or` has been
stabilized in v1.41.0 but we still have an explicit feature
attribute for it.
2019-12-16 22:29:05 -08:00
Manish Goregaokar
f627ae2bbd
Merge pull request #4900 from Mark-Simulacrum/niko-no-never
Update tests for revert of never type stabilization
2019-12-14 17:40:33 -08:00
Mark Rousskov
69f99e74ac Update tests for revert of never type stabilization 2019-12-14 08:40:43 -05:00
bors
d82debbd01 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
2019-12-12 00:34:59 +00:00
bors
221bf650f6 Auto merge of #4886 - rust-lang:must-use-pub-only, r=phansch
Lint only exported must_use_candidates

As promised on #4779, here's the check for publicly visible items for `must_use_candidate`

changelog: none
2019-12-11 12:01:10 +00:00
bors
b245fbd0f2 Auto merge of #4889 - krishna-veerareddy:issue-3993-float-to-int-transmute, r=llogiq
Add lint to detect transmutes from float to integer

Add lint that detects transmutation from a float to an integer and suggests usage of `{f32, f64}.to_bits()` instead.

Fixes #3993

changelog: Add lint `transmute_float_to_int`
2019-12-08 02:23:23 +00:00
Krishna Veera Reddy
23c03e4994 Move transmute_float_to_int test cases into separate file
`transmute.stderr` file line count exceeded due to the new test
cases so moving the new test cases into a separate file.
2019-12-07 17:19:56 -08:00
Krishna Veera Reddy
c77fc06d52 Add lint to detect transmutes from float to integer
Add lint that detects transmutation from a float to an integer
and suggests usage of `{f32, f64}.to_bits()` instead.
2019-12-07 16:33:49 -08:00
Andre Bogus
a60177cc1e Lint only exported must_use_candidates 2019-12-06 20:10:14 +01:00
bors
61b19a1a28 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)]`.

Closes #4854.

changelog: adds lint for `missing_errors_doc`
2019-12-06 11:30:43 +00:00
RobbieClarken
f5d0a452ba 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)]`.

Closes #4854.
2019-12-06 17:19:05 +10:30
Krishna Veera Reddy
c0fb74baf5 Add widening tests for cast_sign_loss lint 2019-12-05 17:18:27 -08:00
Krishna Veera Reddy
7002a9ee83 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.
2019-12-05 15:47:15 -08:00
bors
ff1607ea4a 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.
2019-12-05 10:33:07 +00:00
daxpedda
946961d19e
Change to only detect in external macros. 2019-12-05 11:06:13 +01:00
daxpedda
d11b958faf
Fix false positive in string_add. 2019-12-04 21:51:02 +01:00
bors
374db5c0b7 Auto merge of #4879 - matthiaskrgr:rustup_23, r=flip1995
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
2019-12-04 00:35:36 +00:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878 2019-12-04 01:34:01 +01:00
bors
c66cca44c8 Auto merge of #4877 - flip1995:manual_swap_4853, r=llogiq
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
2019-12-03 18:36:19 +00:00
bors
f0fc18a710 Auto merge of #4878 - flip1995:rustup, r=flip1995
Rustup

Included rustups:

- rust-lang/rust#66935 (syntax: Unify macro and attribute arguments in AST)
- rust-lang/rust#66941 (Remove `ord` lang item)

Fixes? #2597

changelog: none
2019-12-03 17:56:14 +00:00
flip1995
7162393103
Update op_ref.stderr 2019-12-03 18:37:07 +01:00
flip1995
c56f72da35
Make OP_REF lint suggestion MaybeIncorrect
cc #2597
2019-12-03 18:37:07 +01:00
Christopher Durham
718558064d
Fire clippy::op_ref on PartialOrd but !Ord types 2019-12-03 18:37:07 +01:00
flip1995
f6a75f17f6
Rustup to rust-lang/rust#66935 2019-12-03 18:37:06 +01:00
flip1995
aa2381d9d0
Fix rustdoc examples 2019-12-03 16:29:05 +01:00
flip1995
1e3b24de43
Make manual_swap autofixable 2019-12-03 13:42:05 +01:00
flip1995
bd39a608a8
Formatting 2019-12-03 13:25:41 +01:00
flip1995
d1d5f790f5
Fix FP in manual_swap lint with slice-like types 2019-12-03 13:25:41 +01:00
flip1995
d3232b0fce
Add regression test for manual_swap 2019-12-03 13:25:41 +01:00
bors
7a943a9dfc Auto merge of #4875 - flip1995:rustup, r=matthiaskrgr
Rustup to rust-lang/rust#64736

cc rust-lang/rust#64736

Fixes #4872

changelog: none
2019-12-02 20:14:36 +00:00
flip1995
511deceb36
Normalize custom ICE test
Fixes #4872
2019-12-02 20:42:39 +01:00
flip1995
286b39d2e5
Rustup to rust-lang/rust#64736 2019-12-02 20:39:40 +01:00
bors
574f3fdae5 Auto merge of #4873 - phansch:rustup2, r=eddyb
Rustup to https://github.com/rust-lang/rust/pull/66789

changelog: none
2019-12-02 15:14:18 +00:00
Philipp Hansch
474e9a131d
Use assert_crate_local for a more explicit error
`assert_crate_local` does the same as the previous `if let` but with a
more explicit error message if it's not a `ClearCrossCrate::Set`.
2019-12-02 12:09:38 +01:00
Philipp Hansch
6669c2c6ce
Rustup to https://github.com/rust-lang/rust/pull/66789 2019-12-02 09:51:35 +01:00
bors
45196cee02 Auto merge of #4690 - lzutao:fix-test-on-non-amd64, r=flip1995
generate stderr file on 32bit pointer system

changelog: none
2019-12-01 18:39:21 +00:00
bors
5a75502938 Auto merge of #4870 - lzutao:check-macro-missing_inline_in_public_items, r=flip1995
account for external macro in MISSING_INLINE_IN_PUBLIC_ITEMS lint

Closes #4861
changelog: Fix FP (external macro) in [`missing_inline_in_public_items`] lint
2019-12-01 18:21:57 +00:00
Lzu Tao
5488672d1f account for external macro in MISSING_INLINE_IN_PUBLIC_ITEMS lint 2019-12-01 19:38:01 +07:00
Lzu Tao
7156aa7f95 build(tests/fmt): use shared target dir 2019-12-01 19:07:02 +07:00
Lzu Tao
142b289a51 chore: fix and split some ui tests on 32bit system 2019-12-01 19:07:02 +07:00
Lzu Tao
94aa0398c2 build: set up build job for i686 targets 2019-12-01 19:07:02 +07:00
Lzu Tao
83b90d8a86 remove needless my_lint ui test 2019-12-01 09:56:47 +07:00
Lzu Tao
6a66c9fe64 git quiet 2019-12-01 09:56:47 +07:00
bors
e47ae20b5b 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.

changelog: none
2019-12-01 00:13:17 +00:00
bors
b561b6c6e8 Auto merge of #4868 - lzutao:deploy-in-dir, r=phansch
deploy: cd to out/ before adding files to git

It should work now: https://travis-ci.com/lzutao/rust-clippy/jobs/261801929
Closes #4785
changelog: none
2019-11-30 19:15:08 +00:00
Lzu Tao
700f664dcd deploy: cd to out/ before adding files to git 2019-11-30 23:19:13 +07:00
bors
e4d09975d0 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

changelog: none

cc @lzutao
2019-11-30 12:46:30 +00:00