Commit graph

9124 commits

Author SHA1 Message Date
liuzhenyu
24a6130da2 fix typos 2020-08-02 23:20:00 +08:00
Philipp Hansch
bb6e857980
fmt 2020-08-02 14:22:54 +02:00
Philipp Hansch
cb00cdf0d7
Remove old Symbol reexport
I couldn't really tell what it was meant to improve. It seems more clear
without the renaming to `Name`?
2020-08-02 11:25:03 +02:00
Valentin Lazureanu
aa3d9ca0e9 Rename HAIR to THIR (Typed HIR). 2020-07-31 22:15:12 +00:00
Dmitry Murzin
d4ba561aaf
Review fixes 2020-07-31 00:28:21 +03:00
Dmitry Murzin
a427c99f3d
Handle mapping to Option in map_flatten lint 2020-07-30 23:23:33 +03:00
Oliver Scherer
98f3c79385 Update clippy ui test.
The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.
2020-07-29 22:14:19 +02:00
Christoph Walcher
2b7fde6a4b
typo fix 2020-07-29 16:10:15 +02:00
bors
2e0f8b6cc6 Auto merge of #5843 - dima74:iter_skip_next.add-suggestion, r=phansch
Add suggestion for `iter_skip_next` lint

changelog: Add suggestion for [`iter_skip_next`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next) lint
2020-07-29 06:10:55 +00:00
bors
73764ab8cd Auto merge of #5840 - flip1995:basics, r=phansch
Basic instruction for new contributors

While answering a few questions to @AB1908, I realized, that our documentation could use some love. Especially the "Getting Started" part for new contributors. So I wrote together some instruction on how to get the toolchain and how to build and test Clippy.

[Rendered](https://github.com/flip1995/rust-clippy/blob/basics/doc/basics.md)

r? @phansch

changelog: none
2020-07-29 05:43:02 +00:00
bors
61eab6e8f9 Auto merge of #5853 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

changelog: none
2020-07-29 01:18:35 +00:00
flip1995
04f4471761
Merge remote-tracking branch 'upstream/master' into rustup 2020-07-29 03:17:23 +02:00
Christoph Walcher
94c50bc8c9
Lint duplicate methods of trait bounds
Fixes #5777
2020-07-28 16:42:26 +02:00
Bastian Kauschke
133e1d6773 clippy 2020-07-27 21:17:28 +02:00
Bastian Kauschke
6ce37fab95 introduce PredicateAtom 2020-07-27 21:07:37 +02:00
Bastian Kauschke
88787083f4 this might be unqualified, but at least it's now quantified 2020-07-27 21:06:36 +02:00
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