Cameron Steffen
ae2a95fadc
Eat dogfood
2021-09-09 17:10:59 -05:00
dswij
dc6f7dc6bf
Add known problems to mut_range_bound
docs
2021-09-08 11:00:27 +08:00
dswij
8fbf75e0f9
mut_range_bound
to check for immediate break from loop
2021-09-08 10:41:37 +08:00
bors
7a0d7d8283
Auto merge of #7596 - lengyijun:option_needless_deref, r=llogiq
...
New lint: option_needless_deref
changelog: [`option_needless_deref`]
fix #7571
2021-09-05 18:11:56 +00:00
xFrednet
62b46125cb
Avoid slice indexing in Clippy (down with the ICEs)
2021-09-05 14:50:13 +02:00
lengyijun
4184cc369a
needless_option_as_deref
2021-09-04 22:18:23 +08:00
Cameron Steffen
c2bb313e7a
Add higher docs and remove some unneeded fields
2021-09-02 12:41:30 +01:00
Cameron Steffen
588367b62e
Fix dogfood
2021-09-02 12:39:54 +01:00
flip1995
61bb96738c
Merge remote-tracking branch 'upstream/master' into rustup2
2021-09-02 12:38:17 +01:00
flip1995
c6e420266a
Set applicability of needless_collect to MaybeIncorrect
2021-08-26 10:01:11 +01:00
lcnr
b1786f62ed
add tcx
to fn walk
2021-08-26 11:00:30 +02:00
Mara Bos
4c847c0dbd
Rollup merge of #88230 - steffahn:a_an, r=oli-obk
...
Fix typos “a”→“an”
Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an.
While automation was used to find these, every change was checked manually.
Changes in submodules get separate PRs:
* https://github.com/rust-lang/stdarch/pull/1201
* https://github.com/rust-lang/cargo/pull/9821
* https://github.com/rust-lang/miri/pull/1874
* https://github.com/rust-lang/rls/pull/1746
* https://github.com/rust-analyzer/rust-analyzer/pull/9984
_folks @ rust-analyzer are fast at merging…_
* https://github.com/rust-analyzer/rust-analyzer/pull/9985
* https://github.com/rust-analyzer/rust-analyzer/pull/9987
* https://github.com/rust-analyzer/rust-analyzer/pull/9989
_For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._
<hr>
This has some overlap with #88226 , but neither is a strict superset of the other.
If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-23 20:45:49 +02:00
Frank Steffahn
c86071898f
Fix typos “a”→“an”
2021-08-22 15:35:11 +02:00
Cameron Steffen
ae02282ad0
Fix clippy let expressions fallout
2021-08-19 14:17:05 -05:00
Jason Newcomb
8cf6dae0ca
Add for_each_local_usage
. Switch LocalUsedVisitor
to a function.
2021-08-16 09:34:42 -04:00
dswij
a09bc1b6fe
Check if let
expr usage in manual_flatten
...
`manual_flatten` should not trigger when match expression in `if let` is
going to be used.
2021-08-16 16:25:10 +08:00
Caio
b97d4c062b
Introduce hir::ExprKind::Let - Take 2
2021-08-15 16:18:26 -03:00
flip1995
1ad5464200
Merge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyup
2021-08-12 11:16:25 +02:00
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
flip1995
2b20f49841
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup
2021-07-29 12:16:06 +02: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