LeSeulArtichaut
fc0af8e4d8
never_loop
: suggest using an if let
instead of a for
loop
2021-08-11 16:35:33 +02:00
Jason Newcomb
205aa88921
Fix while_let_on_iterator
...
When the iterator is one field within a local correctly check for usages of the field
2021-07-31 09:32:54 -04:00
Jason Newcomb
fe75faa6ee
Fix while_let_on_iterator
...
Reborrow mutable references rather then take a reference to them.
2021-07-31 00:11:46 -04:00
xFrednet
12c61612f7
Update lint documentation to use markdown headlines
2021-07-28 14:31:59 +02:00
bors
ceb7a868d3
Auto merge of #7466 - xFrednet:5393-use-more-diagnostic-items, r=flip1995
...
Use diagnostic items where possible
Clippy still uses a bunch of paths in places that could easily use already defined diagnostic items. This PR updates all references to such paths and also removes a bunch of them that are no longer needed after this cleanup.
Some paths are also used to construct new paths and can therefore not be removed that easily. I've added a doc comment to those instances that recommends the use of the diagnostic item where possible.
And that's it, cleaning crew signing off 🧹 🗑️
---
changelog: none
(only internal improvements)
cc: #5393
2021-07-27 08:19:23 +00:00
flip1995
26321b35c8
Merge remote-tracking branch 'upstream/master' into rustup
2021-07-19 11:48:49 +02:00
xFrednet
6030428fd2
Use diagnostic items for Into
, IntoIterator
, LinkedList
, ptr::null
, prt::null_mut
2021-07-14 22:50:59 +02:00
xFrednet
2ac21889bc
Use diagnostic items for BinaryHeap
, BTreeMap
, BTreeSet
, HashMap
, HashSet
, Borrow
, Default
2021-07-14 22:02:59 +02:00
Aman Arora
a9e9b7f9b2
ExprUseVisitor::Delegate consume only when moving
2021-07-14 02:21:08 -04:00
flip1995
ebe52869a3
Merge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup
2021-07-01 18:17:38 +02:00
flip1995
a82a744155
Merge remote-tracking branch 'upstream/master' into rustup
2021-07-01 17:41:24 +02:00
Cameron Steffen
f02632cee6
Move some lints to suspicious
2021-06-25 08:53:29 -05:00
bors
07217e3370
Auto merge of #7262 - Jarcho:while_let_on_iter_closure, r=xFrednet,flip1995
...
fix `while_let_on_iterator` suggestion in a closure
fixes : #7249
A future improvement would be to check if the closure is being used as `FnOnce`, in which case the original suggestion would be correct.
changelog: Suggest `&mut iter` inside a closure for `while_let_on_iterator`
2021-06-08 15:52:40 +00:00
flip1995
6c27482115
Merge commit '3ae8faff4d46ad92f194c2a4b941c3152a701b31' into clippyup
2021-06-03 08:41:37 +02:00
Cameron Steffen
21c829e0c8
Simplify collect expr_ty
2021-05-27 20:54:56 -05:00
Cameron Steffen
6c1ba7c1bc
Fix needless_collect with binding shadowing
2021-05-27 20:39:59 -05:00
Cameron Steffen
d39a11cbe1
Remove clippy_utils::consts re-export
2021-05-27 08:52:10 -05:00
Cameron Steffen
f3e77a454a
Fix allow on some statement lints
2021-05-26 22:07:53 -05:00
mbartlett21
6d73777224
Fix same_item_push.rs
2021-05-25 02:03:31 +00:00
mbartlett21
cadad20da1
Add semicolons up to needless_for_each.rs
2021-05-25 00:54:50 +00:00
Jason Newcomb
7db0e4f791
Suggest &mut iter
inside a closure for while_let_on_iterator
2021-05-21 12:27:40 -04:00
flip1995
97705b7ea6
Merge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup
2021-05-20 13:07:57 +02:00
bors
10db5a6064
Auto merge of #7188 - mgacek8:issue7164_needless_collect_FP, r=xFrednet,flip1995
...
`needless_collect` enhancements
fixes #7164
changelog: `needless_collect`: For `BTreeMap` and `HashMap` lint only `is_empty`, as `len` might produce different results than iter's `count`
changelog: `needless_collect`: Lint `LinkedList` and `BinaryHeap` in direct usage case as well
2021-05-13 16:35:42 +00:00
Mateusz Gacek
b249290448
needless_collect: use snippet_with_applicability
...
+ small code refactor - using early returns.
2021-05-13 17:09:59 +02:00
Jason Newcomb
4713e25ab0
Cleanup of while_let_on_iterator
2021-05-12 21:51:19 -04:00
Jason Newcomb
daca50a515
Improvements to while_let_on_iterator
...
* Suggest `&mut iter` when the iterator is used after the loop.
* Suggest `&mut iter` when the iterator is a field in a struct.
* Don't lint when the iterator is a field in a struct, and the struct is
used in the loop.
* Lint when the loop is nested in another loop, but suggest `&mut iter`
unless the iterator is from a local declared inside the loop.
2021-05-12 21:49:22 -04:00
Mateusz Gacek
171789eb45
needless_collect: Lint LinkedList
and BinaryHeap
in direct usage.
...
Those two types are supported already when used indirectly.
This commit adds support for direct usage as well.
2021-05-07 09:00:51 -07:00
Mateusz Gacek
59ccc1efb3
needless_collect: replace paths with diag items
...
Related to: #5393
2021-05-07 08:40:48 -07:00
Mateusz Gacek
a21607d9b5
needless_collect: For BTreeMap
and HashMap
lint only is_empty
...
- `len` might produce different results than `count`
- they don't have `contain` but `contains_key` method
2021-05-07 08:39:00 -07:00
flip1995
d605882023
Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup
2021-05-06 12:20:44 +02:00
Mateusz Gacek
f79a2a3990
needless_collect: use node_type_opt
instead of node_type
...
It may prevent future ICEs.
2021-05-05 04:52:03 -07:00
Mateusz Gacek
1835d8a238
needless_collect: Add BinaryHeap
for indirect usage lint
2021-05-04 12:38:30 -07:00
Mateusz Gacek
b1faaaeb0c
needless_collect: Lint cases with type annotations
2021-05-04 12:38:30 -07:00
Andre Bogus
63425de77d
while_immutable_cond: check condition for mutation
2021-04-29 10:10:58 +02:00
flip1995
ae72f1adb9
Merge commit '7c7683c8efe447b251d6c5ca6cce51233060f6e8' into clippyup
2021-04-27 16:55:11 +02:00
Andre Bogus
efc4c6c957
extend single_element_loop
to match .iter()
2021-04-26 15:58:58 +02:00
flip1995
02bf692169
Merge commit '98e2b9f25b6db4b2680a3d388456d9f95cb28344' into clippyup
2021-04-22 11:31:13 +02:00
Cameron Steffen
b049c88fbe
Eat dogfood
2021-04-16 11:39:31 -05:00
bors
c3ef585328
Auto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995
...
Fix `explicit_into_iter_loop`
fixes : #6900
changelog: Only lint when `into_iter` is an implementation of `IntoIterator`
2021-04-12 09:45:32 +00:00
bors
aecccbc579
Auto merge of #7047 - camsteffen:lang-ctor, r=flip1995
...
Introduce `is_lang_ctor`
changelog: none
Replaces `is_some_ctor` and `is_ok_ctor`. Removes many path usages.
2021-04-12 08:52:10 +00:00
flip1995
f6d1f368db
Merge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyup
2021-04-08 17:50:13 +02:00
flip1995
ffa2b7da29
Merge remote-tracking branch 'upstream/master' into rustup
2021-04-08 17:36:41 +02:00
Cameron Steffen
7468542328
Introduce is_lang_ctor
2021-04-06 15:05:00 -05:00
Jason Newcomb
6b5778eb17
Fix explicit_into_iter_loop
...
Only lint when `into_iter` is an implementation of `IntoIterator`
Minor cleanups
2021-04-06 12:12:32 -04:00
Jason Newcomb
12fce55766
Fix all occurences of needless_borrow
internally
2021-04-06 10:43:47 -04:00
Amanieu d'Antras
879bfeca54
Use AnonConst for asm! constants
2021-04-06 12:35:41 +01:00
bors
57406c93df
Auto merge of #7018 - Y-Nak:same_item_push, r=Manishearth
...
Don't trigger `same_item_push` if the vec is used in the loop body
fixes #6987
changelog: `same_item_push`: Don't trigger if the `vec` is used in the loop body
2021-04-05 22:57:33 +00:00
Cameron Steffen
6f31ed6c8d
Use DefIdMap and similar aliases
2021-04-03 18:02:49 -05:00
Cameron Steffen
33798bb064
Improve needless_collect output
2021-04-02 10:10:54 -05:00
Cameron Steffen
4356a8f8f7
Remove redundant emit()
2021-04-02 09:38:13 -05:00