From 81b4a56b51aeed710bcfa6e6172f20e3d4a5696b Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 11 Jul 2023 01:43:27 +0900 Subject: [PATCH] Fix clippy::useless_conversion warning ``` warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> futures/tests/stream_select_all.rs:83:38 | 83 | ...ec![stream::iter(vec![1].into_iter()), stream::iter(vec![2].i... | ^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1]` | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> /Users/taiki/projects/sources/rust-lang/futures-rs/futures-util/src/stream/iter.rs:31:8 | 31 | I: IntoIterator, | ^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> futures/tests/stream_select_all.rs:83:73 | 83 | ...)), stream::iter(vec![2].into_iter())]); | ^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![2]` | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> /Users/taiki/projects/sources/rust-lang/futures-rs/futures-util/src/stream/iter.rs:31:8 | 31 | I: IntoIterator, | ^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> futures/tests/stream_select_all.rs:91:29 | 91 | tasks.push(stream::iter(vec![3].into_iter())); | ^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![3]` | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> /Users/taiki/projects/sources/rust-lang/futures-rs/futures-util/src/stream/iter.rs:31:8 | 31 | I: IntoIterator, | ^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> futures/tests/async_await_macros.rs:325:41 | 325 | ...ct!(stream::iter(vec![1].into_iter()), stream::iter(vec![1].... | ^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1]` | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> /Users/taiki/projects/sources/rust-lang/futures-rs/futures-util/src/stream/iter.rs:31:8 | 31 | I: IntoIterator, | ^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` --> futures/tests/async_await_macros.rs:325:76 | 325 | ...)), stream::iter(vec![1].into_iter())); | ^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1]` | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` --> /Users/taiki/projects/sources/rust-lang/futures-rs/futures-util/src/stream/iter.rs:31:8 | 31 | I: IntoIterator, | ^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion ``` --- futures/tests/async_await_macros.rs | 3 +-- futures/tests/stream_select_all.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/futures/tests/async_await_macros.rs b/futures/tests/async_await_macros.rs index 82a617f2c2..e87a5bf05c 100644 --- a/futures/tests/async_await_macros.rs +++ b/futures/tests/async_await_macros.rs @@ -321,8 +321,7 @@ fn stream_select() { assert_eq!(endless_ones.next().await, Some(1)); assert_eq!(endless_ones.next().await, Some(1)); - let mut finite_list = - stream_select!(stream::iter(vec![1].into_iter()), stream::iter(vec![1].into_iter())); + let mut finite_list = stream_select!(stream::iter(vec![1]), stream::iter(vec![1])); assert_eq!(finite_list.next().await, Some(1)); assert_eq!(finite_list.next().await, Some(1)); assert_eq!(finite_list.next().await, None); diff --git a/futures/tests/stream_select_all.rs b/futures/tests/stream_select_all.rs index fdeb7b997a..12a9936677 100644 --- a/futures/tests/stream_select_all.rs +++ b/futures/tests/stream_select_all.rs @@ -79,8 +79,7 @@ fn works_1() { #[test] fn clear() { - let mut tasks = - select_all(vec![stream::iter(vec![1].into_iter()), stream::iter(vec![2].into_iter())]); + let mut tasks = select_all(vec![stream::iter(vec![1]), stream::iter(vec![2])]); assert_eq!(block_on(tasks.next()), Some(1)); assert!(!tasks.is_empty()); @@ -88,7 +87,7 @@ fn clear() { tasks.clear(); assert!(tasks.is_empty()); - tasks.push(stream::iter(vec![3].into_iter())); + tasks.push(stream::iter(vec![3])); assert!(!tasks.is_empty()); tasks.clear();