Commit graph

9058 commits

Author SHA1 Message Date
Bastian Kauschke
dfa1af2059 clippy 2020-07-27 21:06:36 +02:00
bors
d3e9db71c9 Auto merge of #5850 - giraffate:chmod_utils_ats_utils, r=flip1995
Small fix: `chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

changelog: none

It looks like `clippy_lints/src/utils/ast_utils.rs` doesn't have to be an executable file.
2020-07-27 15:27:01 +00:00
Takayuki Nakata
3a9ccffed8 chmod 644 clippy_lints/src/utils/ast_utils.rs 2020-07-27 22:27:54 +09:00
Ryan1729
94b10a6e5a run cargo dev update_lints 2020-07-27 00:31:09 -06:00
Ryan1729
12a6eee045 fill in lint description for DERIVE_ORD_XOR_PARTIAL_ORD 2020-07-27 00:22:39 -06:00
Ryan1729
ca03f2b650 s/pord/partial_ord/ to fix dogfood failure 2020-07-27 00:21:11 -06:00
Ryan1729
668b7474b4 run cargo dev fmt and fix overly long line 2020-07-26 23:30:00 -06:00
Ryan1729
431924ccf6 add description for derive_ord_xor_partial_ord 2020-07-26 23:15:36 -06:00
Ryan1729
7dc974815e remove is_local check since getting the def_id directly makes it unnecessary 2020-07-26 23:06:36 -06:00
Ryan1729
6c3e4591b8 update reference since we see the expected four errors 2020-07-26 23:04:25 -06:00
Ryan1729
a8d6eda930 use get_trait_def_id to check for Ord trait 2020-07-26 23:04:04 -06:00
Ryan1729
068acbd27b initial implementation based on code for derive_hash_xor_partial_eq which is showing one error when there should be four 2020-07-26 22:04:46 -06:00
Ryan1729
0722991b62 add test for derive_ord_xor_partial_ord based on test for derive_hash_xor_partial_eq 2020-07-26 21:36:50 -06:00
Ryan1729
fc20ee63a1 move derive_ord_xor_partial_ord into derive mod so we can reuse derive_hash_xor_partial_eq code later 2020-07-26 20:54:04 -06:00
Ryan1729
5a644964fc run cargo dev new_lint
specifically:
cargo dev new_lint --name derive_ord_xor_partial_ord --category correctness --pass late
2020-07-26 20:40:57 -06:00
bors
f5d429cd76 Auto merge of #5820 - ThibsG:FixSuspiciousArithmeticImpl, r=flip1995
Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` …

As discussed in #3215, the `suspicious_trait_impl` lint causes too many false positives, as it is complex to find out if binary operations are suspicious or not.

This PR restricts the number of binary operations to at most one, otherwise we don't lint.
This can be seen as very conservative, but at least FP can be reduced to bare minimum.

Fixes: #3215

changelog: limit the `suspicious_arithmetic_impl` lint to one binop, to avoid many FPs
2020-07-26 19:48:17 +00:00
flip1995
d164ab65f7 Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup 2020-07-26 21:07:07 +02:00
bors
da5a6fb1b6 Auto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc
Fix FP `useless_conversion`

Fix #5833.

changelog: none
2020-07-26 17:50:54 +00:00
Takayuki Nakata
c81bbd05b9 Fix FP useless_conversion
Fix #5833.
2020-07-25 23:58:22 +09:00
Dmitry Murzin
b375f1dd20
Add suggestion for iter_skip_next lint 2020-07-25 17:11:55 +03:00
flip1995
3a4cc9f7f0
Address review comments 2020-07-24 23:17:52 +02:00
flip1995
17903f6d71
Mention lint naming guidelines earlier 2020-07-24 17:48:43 +02:00
bors
79f948ec0a Auto merge of #5829 - JohnTitor:epsilon, r=flip1995
Use `(std::)f64::EPSILON` in the examples as suggested in the lints

`float_cmp(_const)` suggests using `{f32|f64}::EPSILON` and it'd be great if the docs mentioned it.

changelog: none
2020-07-23 18:48:35 +00:00
bors
b4e4fa51ea Auto merge of #5832 - rust-lang:update_usage_instr, r=Manishearth
Update Usage section of README.md

Fixes #5826

changelog: none
2020-07-23 18:15:08 +00:00
Philipp Krones
bdc01c882e
Update Usage section of README.md 2020-07-22 18:07:33 +02:00
flip1995
51f2a6f8b6
Add documentation for basic Clippy hacking 2020-07-22 16:46:32 +02:00
bors
8c83d5f484 Auto merge of #5830 - flip1995:rustup, r=flip1995
trait_sel: only test predicates w/ no substs

r? @ghost
changelog: none
2020-07-21 22:10:04 +00:00
Yuki Okushi
142a273441
Use (std::)f64::EPSILON in the examples as suggested in the lints 2020-07-22 05:23:55 +09:00
David Wood
b7c8b96e66 trait_sel: only test predicates w/ no substs
This commit modifies the `substitute_normalize_and_test_predicates`
query, renaming it to `impossible_predicates` and only checking
predicates which do not require substs. By making this change,
polymorphization doesn't have to explicitly support vtables.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:26 +01:00
bors
61e3d8a55c Auto merge of #5824 - tmiasko:manually-drop-clone, r=Manishearth
Ignore not really redundant clones of ManuallyDrop

"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:

```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
    // Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
    let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
    // Now increase refcount, but don't drop new refcount either
    let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```

changelog: Ignore redundant clone lint for ManuallyDrop.
2020-07-20 01:36:21 +00:00
Tomasz Miąsko
a5cdd4aeb1 Ignore not really redundant clones of ManuallyDrop
"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:

```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
    // Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
    let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
    // Now increase refcount, but don't drop new refcount either
    let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```

Ignore redundant clone lint for ManuallyDrop.
2020-07-20 00:56:27 +02:00
bors
942e0e6fac Auto merge of #5800 - montrivo:bugfix/redundant_closure, r=matthiaskrgr
redundant_closure_call - don't lint when used more than once

Fixes #3354.

changelog: fix redundant_closure_call false positive when closure called more than once
2020-07-19 22:54:29 +00:00
Tim Nielens
1ac8b85c9f redundant_closure_call - pr review 2020-07-20 00:36:31 +02:00
Tim Nielens
9603d9652b redundant_closure_call - add support for shadowed closures 2020-07-20 00:30:43 +02:00
Tim Nielens
0fecaf1abc redundant_closure_call - extract lint from misc_early.rs, adapt to LatePass 2020-07-20 00:30:43 +02:00
Tim Nielens
c720d823e1 redundant_closure_call - don't lint when used more than once 2020-07-20 00:30:43 +02:00
ThibsG
442c8ae23b Fix FP for suspicious_arithmetic_impl from suspicious_trait_impl lint 2020-07-19 00:00:17 +02:00
bors
8cf4219c16 Auto merge of #5815 - JarredAllen:redundant_pattern_bugfix, r=flip1995
Redundant pattern bugfix

changelog: Fixes the bug reported #5766
2020-07-18 14:43:36 +00:00
bors
799eef6919 Auto merge of #5818 - flip1995:rustup, r=flip1995
Rename TypeckTables to TypeckResults.

r? @ghost

changelog: none
2020-07-18 13:11:03 +00:00
flip1995
0f501ac1db
Merge remote-tracking branch 'upstream/master' into rustup 2020-07-18 15:09:58 +02:00
bors
9a945c7413 Auto merge of #5817 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

Preparation for emergency Clippyup to fix an ICE #5816

changelog: none
2020-07-17 19:41:39 +00:00
flip1995
3d3a13d871
Fix sync fallout (fmt) 2020-07-17 21:39:05 +02:00
JarredAllen
e85b590936 Fix bug in lint 2020-07-17 10:40:01 -07:00
JarredAllen
7c5d4a4145 Add test for correct behavior 2020-07-17 09:27:43 -07:00
bors
1367f25fbf Auto merge of #5814 - giraffate:fix_typo, r=flip1995
Fix typo

changelog: none
2020-07-17 14:33:05 +00:00
Takayuki Nakata
e5105e82d3 Fix typo 2020-07-17 22:51:57 +09:00
Valentin Lazureanu
5a20489c5c Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
bors
57678c8315 Auto merge of #5811 - JarredAllen:panic_multiple_args, r=phansch
Panic multiple args

changelog: Fixes bug with `panic` lint reported in #5767. I also did the same changes to the lints for `todo`, `unimplemented` and `unreachable`, so those lints should now also detect calls to those macros with a message.
2020-07-17 06:41:20 +00:00
bors
82c8f25efa Auto merge of #5810 - matthiaskrgr:typos_2, r=Manishearth
fix typos (found by codespell)

changelog: none
2020-07-17 02:08:22 +00:00
Matthias Krüger
3618b97f59 fix typos (found by codespell) 2020-07-17 01:58:41 +02:00