about summary refs log tree commit diff
path: root/tests/coverage/branch/lazy-boolean.coverage
diff options
context:
space:
mode:
authorRobert Spencer <me@robertandrewspencer.com>2024-07-03 20:31:56 +0100
committerRobert Spencer <me@robertandrewspencer.com>2024-10-29 21:32:00 +0000
commitacc3842d438028bf5649e9715b74791ea4ec6c83 (patch)
treec47c3282d6be0a10aca0f150fcf36be5c4c146d5 /tests/coverage/branch/lazy-boolean.coverage
parent35a7095d8c440663b1beb77bafb12b0f3d482b43 (diff)
downloadrust-acc3842d438028bf5649e9715b74791ea4ec6c83.tar.gz
rust-acc3842d438028bf5649e9715b74791ea4ec6c83.zip
Add new `map_with_unused_argument_over_ranges` lint
This lint checks for code that looks like
```rust
  let something : Vec<_> = (0..100).map(|_| {
    1 + 2 + 3
  }).collect();
```
which is more clear as
```rust
  let something : Vec<_> = std::iter::repeat_with(|| {
    1 + 2 + 3
  }).take(100).collect();
```
or
```rust
  let something : Vec<_> =
      std::iter::repeat_n(1 + 2 + 3, 100)
      .collect();
```

That is, a map over a range which does nothing with the parameter
passed to it is simply a function (or closure) being called `n`
times and could be more semantically expressed using `take`.
Diffstat (limited to 'tests/coverage/branch/lazy-boolean.coverage')
0 files changed, 0 insertions, 0 deletions