Skip to content

Commit

Permalink
allow manual_repeat_n in other test
Browse files Browse the repository at this point in the history
  • Loading branch information
lapla-cogito committed Dec 20, 2024
1 parent 2208d8a commit 0667d78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tests/ui/from_iter_instead_of_collect.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![warn(clippy::from_iter_instead_of_collect, clippy::manual_repeat_n)]
#![warn(clippy::from_iter_instead_of_collect)]
#![allow(unused_imports)]
#![allow(clippy::useless_vec)]
#![allow(clippy::useless_vec, clippy::manual_repeat_n)]

use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};

Expand All @@ -19,7 +19,7 @@ impl<'a> FromIterator<&'a bool> for Foo {
}

fn main() {
let iter_expr = std::iter::repeat_n(5, 5);
let iter_expr = std::iter::repeat(5).take(5);
let _ = iter_expr.collect::<Vec<_>>();

let _ = vec![5, 5, 5, 5].iter().enumerate().collect::<HashMap<usize, &i8>>();
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/from_iter_instead_of_collect.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![warn(clippy::from_iter_instead_of_collect, clippy::manual_repeat_n)]
#![warn(clippy::from_iter_instead_of_collect)]
#![allow(unused_imports)]
#![allow(clippy::useless_vec)]
#![allow(clippy::useless_vec, clippy::manual_repeat_n)]

use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};

Expand Down
11 changes: 1 addition & 10 deletions tests/ui/from_iter_instead_of_collect.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ LL | <Self as FromIterator<bool>>::from_iter(iter.into_iter().copied())
= note: `-D clippy::from-iter-instead-of-collect` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::from_iter_instead_of_collect)]`

error: this `.repeat().take()` can be written more concisely
--> tests/ui/from_iter_instead_of_collect.rs:22:21
|
LL | let iter_expr = std::iter::repeat(5).take(5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(5, 5)`
|
= note: `-D clippy::manual-repeat-n` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_repeat_n)]`

error: usage of `FromIterator::from_iter`
--> tests/ui/from_iter_instead_of_collect.rs:23:13
|
Expand Down Expand Up @@ -100,5 +91,5 @@ error: usage of `FromIterator::from_iter`
LL | for _i in Vec::<&i32>::from_iter([1, 2, 3].iter()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `[1, 2, 3].iter().collect::<Vec<&i32>>()`

error: aborting due to 16 previous errors
error: aborting due to 15 previous errors

0 comments on commit 0667d78

Please sign in to comment.