Commit graph

12 commits

Author SHA1 Message Date
bors
841f2199e0 Auto merge of #10416 - Jarcho:explicit_iter_loop_ext, r=Manishearth
Extend `explicit_iter_loop` and `explicit_into_iter_loop`

fixes #1518

Some included cleanups
* Split `for_loop` test into different files for each lint (partially).
* Move handling of some `into_iter` cases from `explicit_into_iter`.

---

changelog: Enhancement: [`explicit_iter_loop`]: Now also handles types that implement `IntoIterator`.
[#10416](https://github.com/rust-lang/rust-clippy/pull/10416)

changelog: Sugg: [`explicit_into_iter_loop`]: The suggestion now works on mutable references.
[#10416](https://github.com/rust-lang/rust-clippy/pull/10416)
<!-- changelog_checked -->
2023-06-12 05:30:32 +00:00
Centri3
26f50395ba Add needless_if lint 2023-06-10 06:51:03 -05:00
Jason Newcomb
974900b50e Split for_loops tests 2023-06-09 21:39:58 -04:00
Icxolu
84f89f30eb enhance needless_collect
Updates `needless_collect` to lint for collecting into a method or
function argument thats taking an `IntoIterator` (for example `extend`).
Every `Iterator` trivially implements `IntoIterator` and colleting it
only causes an unnecessary allocation.
2023-05-14 18:47:16 +02:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
Jason Newcomb
8bfc8bc5e0 Lint needless_collect on non-std collection types 2022-11-07 14:14:04 -05: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
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
Takayuki Maeda
7223ee6590 allow clippy::iter_count 2021-02-27 14:16:01 +09:00
Eduardo Broto
888657e09a Fix ICE in loops module 2020-08-08 18:13:43 +02:00
Ericko Samudera
32fde0b511 New lint: iter_next_slice 2020-06-01 03:08:51 +07:00
Manish Goregaokar
980650eec2 needless_collect: fix suggestion, make test rustfixable 2019-09-25 14:45:18 -07:00