Commit Graph

12314 Commits

Author SHA1 Message Date
bors
fb61d04896 Auto merge of #7669 - Labelray:if_then_panic, r=giraffate
New lint `if_then_panic`

changelog: add the new lint [`if_then_panic`]
fix #7645
2021-09-24 14:43:51 +00:00
bors
2e38bc16eb Auto merge of #7715 - F3real:vec2, r=camsteffen
Avoid needless heap allocation in box_collection

Fix issue left from previous PR

changelog: none.

r? `@Manishearth`
2021-09-24 14:24:41 +00:00
Labelray
543b638dbe Add new lint if_then_panic 2021-09-24 22:14:20 +08:00
F3real
7a4a556100 Avoid needless heap allocation in box_collection 2021-09-24 11:02:22 +02:00
bors
cd3f3cf8a8 Auto merge of #7707 - Jarcho:suspicious_else_proc_mac, r=Manishearth
Don't lint `suspicious_else_formatting` inside proc-macros

fixes: #7650

I'll add a test for this one soon.

changelog: Don't lint `suspicious_else_formatting` inside proc-macros
2021-09-23 16:14:29 +00:00
Jason Newcomb
e69154f370
Add test for #7650 2021-09-23 11:22:38 -04:00
Jason Newcomb
5efd6bc6c3
Don't lint suspicious_else_formatting inside proc-macros 2021-09-23 01:13:21 -04:00
bors
ef2e2f0a0c Auto merge of #7693 - F3real:vec2, r=Manishearth
Expand box_vec lint to box_collection

fixed #7451

changelog: Expand `box_vec` into [`box_collection`], and have it error on all sorts of boxed collections
2021-09-22 22:13:13 +00:00
F3real
bb971e0f58 Add missing reference to box_vec 2021-09-22 20:06:03 +02:00
bors
3cd54ba637 Auto merge of #7704 - camsteffen:pedantic-occasional, r=Manishearth
Tweak pedantic description for occasional FPs

changelog: none

Okay this is getting a bit picky (you might even say pedantic). I think we need to be careful not use the pedantic category as cover-all for lints with any amount of false positives. Lints with a high degree of FPs should be nursery or restriction IMO. If the pedantic category were to yield, say hypothetically, over 50% FPs, it would just be too annoying to use at all (to be sure, "too picky for me" is not a FP).

CC `@rust-lang/clippy`
2021-09-22 16:55:34 +00:00
Cameron Steffen
27bb76b5f3 Tweak pedantic description for occasional FPs 2021-09-22 10:49:11 -05:00
bors
a4a8ec2d52 Auto merge of #7679 - lengyijun:issue4546, r=xFrednet
add #4546 test

changelog: none
fixed #4546

I notice #4546 was fixed some time, I just add the tests.
2021-09-22 09:00:30 +00:00
lengyijun
b68325ecf6 add #4546 test 2021-09-22 16:04:04 +08:00
bors
8a75002930 Auto merge of #7685 - camsteffen:let-else-needless-ret, r=giraffate
Fix needless_return with let-else

changelog: Fix needless_return FP with `let...else`

Fixes #7637
2021-09-22 00:23:23 +00:00
bors
848e5518d6 Auto merge of #7694 - Jarcho:lintcheck_retry, r=matthiaskrgr
Retry on some download errors in lintcheck

I'm currently on spotty wifi right now. It is shocking the number of things that break when you lose connection for a few seconds. Some 500 errors should probably also be retried, but this fixes my issue.

changelog: None
2021-09-21 16:59:48 +00:00
F3real
7f96b358b0 Register lint rename 2021-09-20 23:07:17 +02:00
Jason Newcomb
41fe5461f4
Retry on some download errors in lintcheck 2021-09-20 12:50:59 -04:00
F3real
63ed2f9eb4 Expand BOX_VEC to BOX_COLLECTION 2021-09-20 10:23:55 +02:00
bors
871ad80bb0 Auto merge of #7690 - Jarcho:while_loop_by_ref, r=xFrednet
Change `while_let_on_iterator` suggestion to use `by_ref()`

It came up in the discussion #7659 that suggesting `iter.by_ref()` is a clearer suggestion than `&mut iter`. I personally think they're equivalent, but if `by_ref()` is clearer to people then that should be the suggestion.

changelog: Change `while_let_on_iterator` suggestion when using `&mut` to use `by_ref()`
2021-09-19 17:37:04 +00:00
Cameron Steffen
b36591217d Fix needless_return with let-else 2021-09-18 09:42:51 -05:00
Jason Newcomb
ee6a6b55c4
Change the suggestion for while_let_on_iterator when the iterator cannot be consumed to iter.by_ref() 2021-09-17 21:44:21 -04:00
bors
59cd77710d Auto merge of #7657 - dswij:needless-borrow-mut, r=llogiq
`needless_borrow` checks for mutable borrow

closes #7635

changelog: [`needless_borrow`] now checks for needless mutable borrow
2021-09-17 22:25:07 +00:00
bors
ed7a82ef05 Auto merge of #7653 - lengyijun:same_name_method_crate, r=llogiq
New lint: `same_name_method`

changelog: ``[`same_name_method`]``
fix: https://github.com/rust-lang/rust-clippy/issues/7632

It only compares a method in `impl` with another in `impl trait for`
It doesn't lint two methods in two traits.

I'm not sure my approach is the best way. I meet difficulty in other approaches.
2021-09-17 22:02:04 +00:00
bors
f99b4adb93 Auto merge of #7678 - lengyijun:issue3414, r=giraffate
add #3414 test

changelog: none
fixes #3414

I found #3414 was fixed some time. So I add the tests.
2021-09-17 02:07:11 +00:00
lyj
fb78365332 add 3414 test 2021-09-16 16:52:57 +08:00
bors
2316f4da83 Auto merge of #7671 - dtolnay-contrib:singlecharnames, r=xFrednet
Downgrade many_single_char_names to pedantic

As suggested by `@flip1995` in https://github.com/rust-lang/rust-clippy/issues/7666#issuecomment-918993215, by today's standards this lint would be considered `pedantic`.

This is one of the most widely suppressed Clippy lints on crates.io according to https://github.com/dtolnay/noisy-clippy.

In my opinion this lint is just too domain specific for Clippy to have reliable visibility into. Sure there are some cases where the author is just being lazy and could use a kick in the butt, but we're still left with an enormous number of suppressions where single chars are the most appropriate name. For example in the context of colors, a function using `h`, `s`, `l`, `r`, `g`, `b` is 100% sensible and spelling all those out is silly, but it's past the default lint threshold.

---

changelog: Moved [`many_single_char_names`] to `pedantic`
2021-09-14 17:37:32 +00:00
David Tolnay
c2783c1dcb
Downgrade many_single_char_names to pedantic 2021-09-14 09:59:06 -07:00
bors
746a0051c3 Auto merge of #7640 - kneasle:mut-key-false-positive, r=camsteffen
Improve accuracy of `mut_key`

Fixes #6745.

Whilst writing the tests for this, I noticed what I believe is a false negative (the code in `@xFrednet's` [comment](https://github.com/rust-lang/rust-clippy/issues/6745#issuecomment-909658267) doesn't trigger the lint).  Currently the tests contain a case for this (which is blatantly ignored), but I'm not at all sure how to implement this (since the lint currently behaves completely differently for ADTs).  I'm not sure what should be done - on the one hand the extra test cases are misleading, but on the other hand they don't cause much harm and would save effort for anyone fixing that false negative.

---

changelog: Improve accuracy of `clippy::mutable_key_type`.
2021-09-14 15:56:07 +00:00
Kneasle
b2ffb28da5 Fix FN for collections/smart ptrs in std 2021-09-14 16:51:09 +01:00
bors
7680c9ba6c Auto merge of #7670 - xFrednet:0000-lets-hope-this-fixes-rustbot-fps, r=camsteffen
Updating issue templates to avoid @rustbot triggers

This adds a space between the ``@`` and the name *rustbot*. This should now surely fix it. If not, I'm giving up.

@ rustbot label +C-bug

---

changelog: none

r? `@camsteffen`
2021-09-14 13:57:41 +00:00
xFrednet
d23994d70b Updating issue templates to avoid @rustbot triggers 2021-09-14 15:49:43 +02:00
lengyijun
e2cdaec984 same_name_method 2021-09-14 09:20:27 +08:00
Kneasle
e0090735f1 Fix FP when using raw pointers as hashed keys 2021-09-13 11:08:50 +01:00
bors
b556398113 Auto merge of #7646 - camsteffen:relative-target, r=flip1995
Target directory cleanup

changelog: none

* .cargo/config now has `target-dir` specified so that it is inherited by child projects. The target directory needs to be shared with clippy_dev, but not necessarily at the project root. (cc #7625)
* Uses `std::env::current_exe` (and its parent directories) whenever possible
* `CLIPPY_DRIVER_PATH` and `TARGET_LIBS` are no longer required from rustc bootstrap (but `HOST_LIBS` still is). These can be removed from the rustc side after merging.
* `CLIPPY_DOGFOOD` and the separate target directory are removed. This was originally added to mitigate #7343.

r? `@flip1995`
2021-09-13 09:57:01 +00:00
dswij
81d57de791 Update needless_borrow test output and expected fix 2021-09-13 12:29:24 +08:00
dswij
46c3076784 Fix needless_borrow not linting mutable reference 2021-09-13 12:29:24 +08:00
dswij
6b4b77aa44 Update test for needless-borrow FP for mutable ref 2021-09-13 12:29:24 +08:00
bors
a64b7698a4 Auto merge of #7661 - camsteffen:eta, r=giraffate
Fix various redundant_closure bugs

changelog: Fix various false negatives and false positives for [`redundant_closure`]

Closes #3071
Closes #4002

This lint is full of weird nuances and this is basically a re-write to tighten up the logic.
2021-09-13 00:39:34 +00:00
bors
2636a1b7b5 Auto merge of #7663 - Jarcho:rsplit_once_order, r=llogiq
Fix result order for `manual_split_once` when `rsplitn` is used

fixes: #7656

changelog: Fix result order for `manual_split_once` when `rsplitn` is used
2021-09-11 08:29:52 +00:00
Jason Newcomb
4c1b6a28e4
Fix result order for manual_split_once when rsplitn is used 2021-09-10 13:05:09 -04:00
bors
e8cd4e5bf0 Auto merge of #7660 - HKalbasi:derivable-impls, r=camsteffen
Fix derivable impl false positives

fix #7654
fix #7655

changelog: none (not released)
2021-09-10 15:32:16 +00:00
hamidreza kalbasi
5aff720e1a fix derivable impl false positives 2021-09-10 19:49:02 +04:30
Cameron Steffen
ae2a95fadc Eat dogfood 2021-09-09 17:10:59 -05:00
Cameron Steffen
5782dc0eb9 Fix redundant closure bugs 2021-09-09 17:10:59 -05:00
bors
d5595e55a2 Auto merge of #7649 - flip1995:backport_remerge, r=flip1995
Backport remerge

This is to keep the backported commit in the repository before force pushing the new beta branch.

r? `@ghost`

changelog: none
(literally none)
2021-09-09 14:47:28 +00:00
flip1995
f402edec1b
Merge remote-tracking branch 'upstream/beta' into backport_remerge 2021-09-09 16:45:20 +02:00
bors
1a524783b1 Auto merge of #7610 - Labelray:master, r=camsteffen
Add new lint `iter_not_returning_iterator`

Add new lint [`iter_not_returning_iterator`] to detect method `iter()` or `iter_mut()` returning a type not implementing `Iterator`
changelog: Add new lint [`iter_not_returning_iterator`]
2021-09-09 01:47:08 +00:00
bors
36e6469301 Auto merge of #7621 - azdavis:master, r=camsteffen
Allow giving reasons for `disallowed_methods`

Fixes #7609.

This permits writing the config for `disallowed-methods` as either a list of strings (like before) or a list of tables, where each table gives the path to the disallowed method and an optional reason for why the method is disallowed.

changelog: Allow giving reasons for [`disallowed_methods`]
2021-09-09 01:31:15 +00:00
Labelray
8f88acdbfa add new lint iter_not_returning_iterator 2021-09-09 09:21:38 +08:00
Ariel Davis
293db0d33c Allow giving reasons for disallowed_methods 2021-09-08 21:12:02 -04:00