Why does rustc say to import module and that import is unused simultaneously?

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3212959891f65b7d2c562284759529c8

warning: unused import: `futures::future::Future`
 --> src/lib.rs:1:5
  |
1 | use futures::future::Future;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0599]: no method named `and_then` found for type `hyper::client::ResponseFuture` in the current scope
 --> src/lib.rs:5:51
  |
5 |     client.get("http://foo.bar".parse().unwrap()).and_then(|resp| resp.into_body().try_concat());
  |                                                   ^^^^^^^^ method not found in `hyper::client::ResponseFuture`
  |
  = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  |
1 | use futures::future::Future;
  |

My guess is that one of those futures::future::Future is from futures 0.1, and the other is from futures 0.3. This can be checked by building this code locally and noting the versions

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.