Commit Graph

8932 Commits

Author SHA1 Message Date
flip1995
17903f6d71
Mention lint naming guidelines earlier 2020-07-24 17:48:43 +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
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
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
bors
d9bf9f01fe Auto merge of #5806 - flip1995:deploy_beta_fix, r=phansch
Fix deploy script for beta deployment

Since the `beta/` directory already exists, we can't copy the complete `master` dir

changelog: none
2020-07-16 19:13:17 +00:00
flip1995
aba0d244d4
Typo: Change Log -> Changelog 2020-07-16 15:40:13 +02:00
flip1995
cf383cf48a
Update changelog to beta-1.46 2020-07-16 15:36:53 +02:00
flip1995
c65eb4d663
Track tag files, before checking for the diff 2020-07-16 14:42:13 +02:00
flip1995
ef896faa01
Fix deploy script for beta deployment
Since the beta/ directory already exists, we can't copy the complete master dir
2020-07-16 13:44:58 +02:00
bors
bb67423577 Auto merge of #5804 - flip1995:backport_remerge, r=flip1995
Backport remerge rust-1.44.1

r? @ghost

changelog: none
2020-07-16 10:47:49 +00:00
flip1995
9aa343594f
Merge remote-tracking branch 'upstream/rust-1.44.1' into backport_remerge 2020-07-16 12:44:57 +02:00
bors
9349441863 Auto merge of #5788 - Leulz:shadow-unrelated-fix-rhs, r=flip1995
Removing RHS snippet from SHADOW_UNRELATED message.

Fixes #5703

I am not sure if I reinvented the wheel here, but I could not really find a snippet function that did this truncation, so I created the function. Please tell me if there was a more obvious way to do this, I am new here. 😄

changelog: Truncates multi-line RHS in shadow_unrelated message if it has more than 5 lines.
2020-07-15 19:09:21 +00:00
bors
b3614b42d5 Auto merge of #5802 - flip1995:rustup, r=flip1995
Rustup

r? @ghost
changelog: none
2020-07-15 18:17:25 +00:00
flip1995
d9bf74e2f2
Merge remote-tracking branch 'upstream/master' into rustup 2020-07-15 20:15:57 +02:00
Leo Meira Vital
a0640457a9 Removing snippet from SHADOW_UNRELATED message. 2020-07-15 11:12:38 -03:00
Bastian Kauschke
bf3104ec24 WithOptConstParam::dummy -> WithOptConstParam::unknown 2020-07-15 13:06:47 +02:00
Bastian Kauschke
c5b9463d26 improve naming 2020-07-15 13:06:47 +02:00
Bastian Kauschke
29de25b8a2 const_eval_resolve 2020-07-15 12:58:32 +02:00
Nicholas Nethercote
f2f99be2ff Remove lots of Symbol::as_str() calls.
In various ways, such as changing functions to take a `Symbol` instead
of a `&str`.
2020-07-15 09:01:35 +10:00
bors
84cdce01cb Auto merge of #5798 - mikerite:fix-2277-2, r=yaahc
Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

changelog: none
2020-07-14 17:23:31 +00:00
bors
128c5dec92 Auto merge of #5793 - warner:5783-nth-zero-next, r=flip1995
improve advice in iter_nth_zero

fixes #5783

*Please keep the line below*
changelog:  For iter_nth_zero, the "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead.
2020-07-14 16:58:23 +00:00
bors
97d7a8b319 Auto merge of #5737 - Uriopass:unit-for-ord, r=flip1995
Reprise: new lint: Unintentional return of unit from closures expecting Ord

This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

Reprise of #5348 where I addressed all the comments there

changelog: add lint [`unit_return_expecting_ord`]
2020-07-14 16:32:25 +00:00
Brian Warner
e83b3eb993 formatting nits 2020-07-14 09:20:19 -07:00
Matthias Krüger
126790999a new lint: Returning unit from closures expecting Ord
This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

reprise: rebase, update and address all concerns
2020-07-14 15:54:04 +02:00
flip1995
6f25adbd5a Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup 2020-07-14 14:59:59 +02:00
bors
2ca58e7dda Auto merge of #5732 - bjorn3:patch-1, r=flip1995
Rename collapsable_if fix suggestion to "collapse nested if block"

The name "try" is confusing when shown as quick fix by rust-analyzer

changelog: Rename `collapsable_if` fix suggestion to "collapse nested if block"
2020-07-14 09:39:01 +00:00