rust/book
Robert Spencer acc3842d43 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`.
2024-10-29 21:32:00 +00:00
..
src Add new map_with_unused_argument_over_ranges lint 2024-10-29 21:32:00 +00:00
book.toml Merge commit 'd7b5cbf065' into clippyup 2022-06-16 17:39:06 +02:00
README.md Merge commit 'fdb84cbfd2' into clippyup 2022-07-18 09:39:37 +02:00

Clippy Book

This is the source for the Clippy Book. See the book for more information.