Commit graph

8334 commits

Author SHA1 Message Date
Jane Lusby
0441525690 Merge remote-tracking branch 'upstream/master' into clippy-fix 2020-04-15 08:24:13 -07:00
ThibsG
3c2bbcf00e Better precedence case management + more tests 2020-04-15 17:18:12 +02:00
ThibsG
72b9ae2a10 Use only check_expr with parent expr and precedence 2020-04-15 17:18:12 +02:00
ThibsG
b6d4330550 Check for Deref trait impl + add fixed version 2020-04-15 17:18:12 +02:00
ThibsG
c1132434a7 Report using stmts and expr + tests 2020-04-15 17:18:12 +02:00
ThibsG
6b4ab82746 Global rework + fix imports 2020-04-15 17:18:12 +02:00
Tom Milligan
b2d986850d Working basic dereference clip 2020-04-15 17:18:12 +02:00
Marcin Serwin
512f23fff1 Add test for zero single char names 2020-04-15 13:35:44 +02:00
Marcin Serwin
d3ebd06ec9 Make the single char threshold strict inequality 2020-04-15 13:35:44 +02:00
Philipp Hansch
69c3e9c90f
large_enum_variant: Report sizes of variants
This reports the sizes of the largest and second-largest variants.
2020-04-15 09:56:32 +02:00
bors
c496f4e63f Auto merge of #5464 - matthiaskrgr:dep_compiletest, r=phansch
deps: bump compiletest-rs from 0.4 to 0.5

changelog: none
2020-04-15 07:39:03 +00:00
bors
a96f874301 Auto merge of #5345 - Toxyxer:add-lint-for-float-in-array-comparison, r=flip1995
Add lint for float in array comparison

Fixes #4277
changelog:
- Added new handler for expression of index kind (e.g. `arr[i]`). It returns a constant when both array and index are constant, or when the array is constant and all values are equal.
- Trigger float_cmp and float_cmp_const lint when comparing arrays. Allow for comparison when one of the arrays contains only zeros or infinities.
- Added appropriate tests for such cases.
2020-04-15 06:39:11 +00:00
bors
c6cc07a851 Auto merge of #5452 - phansch:match_def_path_refactor, r=matthiaskrgr
Refactor: Use rustc's `match_def_path`

This replaces our match_def_path implementation with the rustc one.

Note that we can't just use it in all call sites because of the
`&[&str]` / `&[Symbol]` difference in Clippy/rustc.

changelog: none
2020-04-15 05:42:52 +00:00
Philipp Hansch
9ec95af702
Refactor: Use rustc's match_def_path
This replaces our match_def_path implementation with the rustc one.

Note that we can't just use it in all call sites because of the
`&[&str]` / `&[Symbol]` difference in Clippy/rustc.
2020-04-15 07:23:13 +02:00
bors
81b3e7096b Auto merge of #5449 - phansch:diagnostic-items, r=matthiaskrgr
Make use of more diagnostic items

This makes use of some (not all) already existing diagnostic items. Specifically:

* 79982a2: `core::mem::uninitialized`, `core::mem::zeroed`, `alloc::sync::Arc`, `alloc::sync::Rc`
* 83874d0: `Option` and `Result`

cc #5393

changelog: none
2020-04-14 19:58:17 +00:00
bors
3c77188c04 Auto merge of #5460 - phansch:fix_incorrect_tests, r=matthiaskrgr
result_map_unit_fn: Fix incorrect UI tests

`x` and the `HasResult` struct were missing in this file.

changelog: none
2020-04-14 19:33:11 +00:00
Matthias Krüger
9eda46ece5 deps: bump compiletest-rs from 0.4 to 0.5 2020-04-14 21:29:23 +02:00
bors
d236b30a1d Auto merge of #5457 - phansch:sym, r=matthiaskrgr
Cleanup: Use our `sym!` macro more

It's much shorter than Symbol::intern and the effect should still be clear

---

changelog: none
2020-04-14 12:30:14 +00:00
bors
85e8b64c82 Auto merge of #5463 - matthiaskrgr:rustup_42, r=phansch
rustup https://github.com/rust-lang/rust/pull/70643

changelog: none
2020-04-14 12:18:02 +00:00
Matthias Krüger
c1f2da40ab rustup https://github.com/rust-lang/rust/pull/70643 2020-04-14 12:25:45 +02:00
bors
74e92566d5 Auto merge of #5453 - rabisg0:fix/redundant_clone, r=phansch
Fixes #5405: redundant clone false positive with arrays

Check whether slice elements implement Copy before suggesting to drop
the clone method

changelog: add a check for slice indexing on redundant_clone lint
2020-04-14 05:59:26 +00:00
bors
aa08c39b11 Auto merge of #5458 - phansch:is-proc-macro-attr, r=matthiaskrgr
Cleanup: Use rustc's is_proc_macro_attr

It's doing exactly the same: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast/expand/mod.rs.html#8-12

changelog: none
2020-04-14 05:31:03 +00:00
bors
54344c78f4 Auto merge of #5448 - Emerentius:update_new_ret_no_self_docs, r=phansch
Update documentation for new_ret_no_self

changelog: Update documentation for lint new_ret_no_self to reflect that the return type must only contain `Self`, not be `Self`

The lint was changed to be more lenient than the documentation implies in PR #3338 (Related issue #3313)
2020-04-13 20:32:44 +00:00
bors
6d4cc56703 Auto merge of #5461 - phansch:disable_rustfmt_integration_test, r=matthiaskrgr
Temporarily disable rustfmt integration test

Running rustfmt from master is currently broken and [fails our bors build](https://github.com/rust-lang/rust-clippy/runs/582066368#step:10:19):
https://github.com/rust-lang/rust/issues/71077

changelog: none
2020-04-13 20:17:48 +00:00
Philipp Hansch
a4deb5aca5
Explain panic on E0463 in integration tests 2020-04-13 22:12:57 +02:00
Philipp Hansch
8ad1d780e9
Temporarily disable rustfmt integration test
Running rustfmt from master is currently broken:
https://github.com/rust-lang/rust/issues/71077
2020-04-13 15:31:39 +02:00
Philipp Hansch
9a52d52068
result_map_unit_fn: Fix incorrect UI tests
`x` and the `HasResult` struct were missing in this file.
2020-04-13 15:26:53 +02:00
Philipp Hansch
e47db677ac
Cleanup: Use rustc's is_proc_macro_attr
It's doing exactly the same: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast/expand/mod.rs.html#8-12
2020-04-13 09:33:00 +02:00
Philipp Hansch
31c5664f25
Cleanup: Use our sym! macro more
It's much shorter that Symbol::intern and the result should still be
clear.
2020-04-13 08:57:34 +02:00
Rabi Guha
ab3946d7e9 Fixes #5405: redundant clone false positive with arrays
Check whether slice elements implement Copy before suggesting to drop
the clone method
2020-04-13 11:43:42 +05:30
Michael Sproul
23df4a0183
Disallow bit-shifting in integer_arithmetic lint
With this change, the lint checks all operations that are defined as
being capable of overflow in the Rust Reference.
2020-04-13 13:23:59 +10:00
Emerentius
e98c7a45d4 update lints 2020-04-12 23:47:58 +02:00
Philipp Hansch
a524be6df5
cargo dev fmt 2020-04-12 15:23:54 +02:00
Philipp Hansch
83874d0ee7
Make use of Option/Result diagnostic items 2020-04-12 15:23:07 +02:00
bors
e29d550565 Auto merge of #5454 - spl:patch-1, r=phansch
verbose_bit_mask: fix bit mask used in docs

changelog: fixes verbose_bit_mask docs
2020-04-12 12:54:32 +00:00
Philipp Hansch
79982a2813
Make use of some existing diagnostic items 2020-04-12 13:58:04 +02:00
Philipp Hansch
1d1b6d886b
Say that diagnostic items are preferred over paths 2020-04-12 13:58:04 +02:00
Sean Leather
c4e3ae4f7c
verbose_bit_mask: fix bit mask used in docs
Change the existing hex bit mask (`0x1111`) to a binary one (`0b1111`).

The former does not seem to have anything to do with trailing zeros and is
probably a typo.
2020-04-12 13:11:14 +02:00
bors
af5940b731 Auto merge of #5451 - xyzd:allow-uuid-format-digit-grouping, r=phansch
Allow UUID style formatting for `inconsistent_digit_grouping` lint

This change adds a check to the `inconsistent_digit_grouping` to add a check for
NumericLiterals that follow the UUID format of 8-4-4-4-12.

If the NumericLiteral matches the UUID format, no further inconsistent grouping checks
will be performed.

Closes #5431

changelog: Allow UUID style formatting for `inconsistent_digit_grouping` lint
2020-04-12 08:14:27 +00:00
Dan B
a296058e50 Allow UUID style formatting for inconsistent_digit_grouping lint
This change adds a check to the `inconsistent_digit_grouping` to add a check for
NumericLiterals that follow the UUID format of 8-4-4-4-12.

If the NumericLiteral matches the UUID format, no further inconsistent grouping checks
will be performed.

Closes #5431
2020-04-12 01:24:37 +01:00
bors
97aa8dc778 Auto merge of #5450 - matthiaskrgr:rustup_41, r=phansch
rustup https://github.com/rust-lang/rust/pull/69745

changelog: none
2020-04-11 08:20:11 +00:00
Matthias Krüger
4352c8555b rustup https://github.com/rust-lang/rust/pull/70986 2020-04-11 10:01:23 +02:00
Matthias Krüger
f7bdead5ec rustup https://github.com/rust-lang/rust/pull/69745 2020-04-11 01:51:25 +02:00
bors
5e8c0c5ae0 Auto merge of #5441 - rabisg0:fix/clone-on-copy, r=phansch
Check for clone-on-copy in argument positions

Earlier if arguments to method calls matched the above pattern they were
not reported. This patch ensures such arguments are checked as well.

Fixes #5436

changelog: apply clone_on_copy lint to func args as well
2020-04-10 21:49:26 +00:00
bors
0353f21d23 Auto merge of #5446 - rust-lang:gimme-a-second, r=flip1995
compare with the second largest instead of the smallest variant

This should make the lint less noisy for now. See [my comment](https://github.com/rust-lang/rust-clippy/issues/5418#issuecomment-610440898) to issue #5418.

---

changelog: none
2020-04-10 21:33:45 +00:00
bors
ba7076fb8c Auto merge of #5447 - phansch:rustuppp, r=matthiaskrgr
Rustup to https://github.com/rust-lang/rust/pull/70913

changelog: none
2020-04-10 18:07:03 +00:00
Emerentius
ed72dc4119
Update documentation for new_ret_no_self
The lint was changed to be more lenient than the documentation implies in PR #3338.
Related issue #3313
2020-04-10 19:08:31 +02:00
Philipp Hansch
3ef1dab211
Rustup to https://github.com/rust-lang/rust/pull/70913 2020-04-10 19:03:34 +02:00
Andre Bogus
89f6012a4d compare with the second largest instead of the smallest variant 2020-04-10 17:01:56 +02:00
bors
34763a5f36 Auto merge of #5442 - rust-lang:revert-5420-newret, r=Manishearth
Revert "Downgrade new_ret_no_self to pedantic"

Reverts rust-lang/rust-clippy#5420

This got through with the big rollup merge, where I didn't recheck every PR of the rollup. Reverting because of the reason given in https://github.com/rust-lang/rust-clippy/pull/5420#issuecomment-610744974 by @joshtriplett

changelog: Move new_ret_no_self back to style category
2020-04-09 19:06:26 +00:00