about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-29 17:57:25 +0000
committerbors <bors@rust-lang.org>2023-04-29 17:57:25 +0000
commit7bc3da975a27fe6fe981559171f1cd7a778adb86 (patch)
treebb436c0f1c7f1535428a7bc0926c03e54049f4a7 /tests/rustdoc-js-std/parser-errors.js
parent3594d55439410b9426a4eb81b125b750b1dea36d (diff)
parent9613ea85c65c8c4f75b443e061739c82f75e317d (diff)
downloadrust-7bc3da975a27fe6fe981559171f1cd7a778adb86.tar.gz
rust-7bc3da975a27fe6fe981559171f1cd7a778adb86.zip
Auto merge of #10647 - y21:while_pop_unwrap, r=llogiq
new lint: `manual_while_let_some`

This PR implements the lint I suggested [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/lint.20on.20while.20pop.20unwrap).
It looks for while loops like these:
```rs
let mut numbers = vec![0, 1, 2];
while !numbers.is_empty() {
  let number = numbers.pop().unwrap();
  // use `number`
}
```
and suggests replacing it with a while-let loop, like this:
```rs
let mut numbers = vec![0, 1, 2];
while let Some(number) = numbers.pop() {
  // use `number`
}
```
... which is more concise and idiomatic.

It only looks for `Vec::pop()` calls in the first statement of the loop body in an attempt to not trigger FPs (as pop might only be called conditionally).

changelog: new lint [`manual_while_let_some`]
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions