From 0667d787a660f9f111a476b1dde49934b71abf0b Mon Sep 17 00:00:00 2001 From: lapla-cogito Date: Sat, 21 Dec 2024 02:08:47 +0900 Subject: [PATCH] allow manual_repeat_n in other test --- tests/ui/from_iter_instead_of_collect.fixed | 6 +++--- tests/ui/from_iter_instead_of_collect.rs | 4 ++-- tests/ui/from_iter_instead_of_collect.stderr | 11 +---------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/tests/ui/from_iter_instead_of_collect.fixed b/tests/ui/from_iter_instead_of_collect.fixed index a4d29b25c4cd..67da45a348f9 100644 --- a/tests/ui/from_iter_instead_of_collect.fixed +++ b/tests/ui/from_iter_instead_of_collect.fixed @@ -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}; @@ -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::>(); let _ = vec![5, 5, 5, 5].iter().enumerate().collect::>(); diff --git a/tests/ui/from_iter_instead_of_collect.rs b/tests/ui/from_iter_instead_of_collect.rs index ec25c66a06db..423a7454bed7 100644 --- a/tests/ui/from_iter_instead_of_collect.rs +++ b/tests/ui/from_iter_instead_of_collect.rs @@ -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}; diff --git a/tests/ui/from_iter_instead_of_collect.stderr b/tests/ui/from_iter_instead_of_collect.stderr index f254f3ce3757..0824a526b793 100644 --- a/tests/ui/from_iter_instead_of_collect.stderr +++ b/tests/ui/from_iter_instead_of_collect.stderr @@ -7,15 +7,6 @@ LL | >::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 | @@ -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::>()` -error: aborting due to 16 previous errors +error: aborting due to 15 previous errors