Commit Graph

8954 Commits

Author SHA1 Message Date
Eduardo Broto e336fe80d2 manual_async_fn: take input lifetimes into account
The anonymous future returned from an `async fn` captures all input
lifetimes. This was not being taken into account.

See https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#lifetime-capture-in-the-anonymous-future
2020-08-03 00:36:28 +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
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
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
JarredAllen 07867fde59 Clean up dogfood fallout 2020-07-16 16:58:21 -07:00
JarredAllen 70a41a9281 Enable detecting multiple-argument panics 2020-07-16 16:51:12 -07:00
Nicholas Nethercote 62db617e40 Avoid storing SymbolStr in a struct.
It's intended only for very temporary use.
2020-07-17 08:28:22 +10:00
bors c2cb565a3e Auto merge of #5807 - flip1995:changelog, r=yaahc
Changelog

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

changelog: none
2020-07-16 19:38:57 +00:00