Fix formatting and dogfood fallout
This commit is contained in:
parent
c86f4109fd
commit
a849483294
4 changed files with 41 additions and 26 deletions
|
|
@ -1,16 +1,12 @@
|
|||
// run-rustfix
|
||||
|
||||
#[allow(unused)]
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
|
||||
fn main() {
|
||||
let sample = [1; 5];
|
||||
let indirect_iter = sample.iter().collect::<Vec<_>>();
|
||||
indirect_iter
|
||||
.into_iter()
|
||||
.map(|x| (x, x + 1))
|
||||
.collect::<HashMap<_, _>>();
|
||||
indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
||||
let indirect_len = sample.iter().collect::<VecDeque<_>>();
|
||||
indirect_len.len();
|
||||
let indirect_empty = sample.iter().collect::<VecDeque<_>>();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
// run-rustfix
|
||||
|
||||
#[allow(unused)]
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
|
||||
fn main() {
|
||||
let sample = [1; 5];
|
||||
let indirect_iter = sample.iter().collect::<Vec<_>>();
|
||||
indirect_iter
|
||||
.into_iter()
|
||||
.map(|x| (x, x + 1))
|
||||
.collect::<HashMap<_, _>>();
|
||||
indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
||||
let indirect_len = sample.iter().collect::<VecDeque<_>>();
|
||||
indirect_len.len();
|
||||
let indirect_empty = sample.iter().collect::<VecDeque<_>>();
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:9:5
|
||||
--> $DIR/needless_collect_indirect.rs:8:5
|
||||
|
|
||||
LL | / let indirect_iter = sample.iter().collect::<Vec<_>>();
|
||||
LL | | indirect_iter
|
||||
LL | | indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
||||
| |____^
|
||||
|
|
||||
= note: `-D clippy::needless-collect` implied by `-D warnings`
|
||||
help: Use the original Iterator instead of collecting it and then producing a new one
|
||||
|
|
||||
LL |
|
||||
LL | sample.iter()
|
||||
LL | sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
||||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:14:5
|
||||
--> $DIR/needless_collect_indirect.rs:10:5
|
||||
|
|
||||
LL | / let indirect_len = sample.iter().collect::<VecDeque<_>>();
|
||||
LL | | indirect_len.len();
|
||||
|
|
@ -26,7 +26,7 @@ LL | sample.iter().count();
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:16:5
|
||||
--> $DIR/needless_collect_indirect.rs:12:5
|
||||
|
|
||||
LL | / let indirect_empty = sample.iter().collect::<VecDeque<_>>();
|
||||
LL | | indirect_empty.is_empty();
|
||||
|
|
@ -39,7 +39,7 @@ LL | sample.iter().next().is_none();
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:18:5
|
||||
--> $DIR/needless_collect_indirect.rs:14:5
|
||||
|
|
||||
LL | / let indirect_contains = sample.iter().collect::<VecDeque<_>>();
|
||||
LL | | indirect_contains.contains(&&5);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue