]> git.lizzy.rs Git - rust.git/commit
Auto merge of #8744 - Jarcho:needless_collect_fp, r=llogiq
authorbors <bors@rust-lang.org>
Mon, 7 Nov 2022 20:47:27 +0000 (20:47 +0000)
committerbors <bors@rust-lang.org>
Mon, 7 Nov 2022 20:47:27 +0000 (20:47 +0000)
commit5857a0174249bd5a9c0daeb4a9fde4a3601d7303
tree0e662336a1e381462695686c6d648bac7b45d0bc
parent213003b8874016aadc61195f049fc2d7e773ccad
parent8bfc8bc5e0210dabd2976edad5bf285a96dcb360
Auto merge of #8744 - Jarcho:needless_collect_fp, r=llogiq

Extend `needless_collect`

Extends when `is_empty` and `contains` are linted.

`is_empty` will be linted when `<IterTy as Iterator>::Item` is the same as `<CollectTy as IntoIterator>::Item`. This can be a false positive if the `FromIterator` implementation filters out items, but I don't know of any which do that also implement `IntoIterator` with a matching `Item` type.

`contains` will be linted when the argument type is `&<IterTy as Iterator>::Item`. It has the same false positives as `is_empty` with the same note that I know of nothing that actually causes that in practice.

changelog: Lint `needless_collect` when `is_empty` or `contains` is called on some non-std types