Skip to content

Commit

Permalink
Fix clippy::useless_conversion warning
Browse files Browse the repository at this point in the history
```
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
```
  • Loading branch information
taiki-e committed Jul 10, 2023
1 parent 67b417d commit 81b4a56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions futures/tests/async_await_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions futures/tests/stream_select_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,15 @@ 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());

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();
Expand Down

0 comments on commit 81b4a56

Please sign in to comment.