Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix opaque type warnings #148

Closed
josecelano opened this issue Dec 23, 2022 · 2 comments
Closed

Fix opaque type warnings #148

josecelano opened this issue Dec 23, 2022 · 2 comments

Comments

@josecelano
Copy link
Member

When you run the application or the tests you see these warnings:

$ cargo test
   Compiling torrust-tracker v2.3.0 (/home/josecelano/Documents/github/committer/josecelano/torrust/torrust-tracker)
warning: opaque type `impl warp::Filter + Clone + warp::filter::FilterBase<Extract = impl Reply, Error = Rejection>` does not satisfy its associated type bounds
  --> src/api/routes.rs:50:63
   |
50 | pub fn routes(tracker: &Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
   |                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
  ::: /home/josecelano/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/warp-0.3.3/src/filter/mod.rs:40:19
   |
40 |     type Extract: Tuple; // + Send;
   |                   ----- this associated type bound is unsatisfied for `impl Reply`
   |
   = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
help: add this bound
   |
50 | pub fn routes(tracker: &Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply + warp::generic::Tuple, Error = warp::Rejection> + Clone {
   |                                                                                          ++++++++++++++++++++++

warning: opaque type `impl warp::Filter + Clone + warp::filter::FilterBase<Extract = impl Reply, Error = Infallible>` does not satisfy its associated type bounds
  --> src/http/routes.rs:12:62
   |
12 | pub fn routes(tracker: Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply, Error = Infallible> + Clone {
   |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
  ::: /home/josecelano/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/warp-0.3.3/src/filter/mod.rs:40:19
   |
40 |     type Extract: Tuple; // + Send;
   |                   ----- this associated type bound is unsatisfied for `impl Reply`
   |
help: add this bound
   |
12 | pub fn routes(tracker: Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply + warp::generic::Tuple, Error = Infallible> + Clone {
   |                                                                                         ++++++++++++++++++++++

warning: opaque type `impl warp::Filter + Clone + warp::filter::FilterBase<Extract = impl Reply, Error = Rejection>` does not satisfy its associated type bounds
  --> src/http/routes.rs:19:60
   |
19 | fn announce(tracker: Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply, Error = Rejection> + Clone {
   |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
  ::: /home/josecelano/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/warp-0.3.3/src/filter/mod.rs:40:19
   |
40 |     type Extract: Tuple; // + Send;
   |                   ----- this associated type bound is unsatisfied for `impl Reply`
   |
help: add this bound
   |
19 | fn announce(tracker: Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply + warp::generic::Tuple, Error = Rejection> + Clone {
   |                                                                                       ++++++++++++++++++++++

warning: opaque type `impl warp::Filter + Clone + warp::filter::FilterBase<Extract = impl Reply, Error = Rejection>` does not satisfy its associated type bounds
  --> src/http/routes.rs:29:58
   |
29 | fn scrape(tracker: Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply, Error = Rejection> + Clone {
   |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
  ::: /home/josecelano/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/warp-0.3.3/src/filter/mod.rs:40:19
   |
40 |     type Extract: Tuple; // + Send;
   |                   ----- this associated type bound is unsatisfied for `impl Reply`
   |
help: add this bound
   |
29 | fn scrape(tracker: Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply + warp::generic::Tuple, Error = Rejection> + Clone {
   |                                                                                     ++++++++++++++++++++++

warning: `torrust-tracker` (lib) generated 4 warnings
warning: `torrust-tracker` (lib test) generated 4 warnings (4 duplicates)

We are going to replace Warp with Axum, so it may not make sense to fix them.

@josecelano
Copy link
Member Author

We got rid of the first warning:

warning: opaque type `impl warp::Filter + Clone + warp::filter::FilterBase<Extract = impl Reply, Error = Rejection>` does not satisfy its associated type bounds
  --> src/api/routes.rs:50:63
   |
50 | pub fn routes(tracker: &Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
   |                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
  ::: /home/josecelano/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/warp-0.3.3/src/filter/mod.rs:40:19
   |
40 |     type Extract: Tuple; // + Send;
   |                   ----- this associated type bound is unsatisfied for `impl Reply`
   |
   = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
help: add this bound
   |
50 | pub fn routes(tracker: &Arc<tracker::Tracker>) -> impl Filter<Extract = impl warp::Reply + warp::generic::Tuple, Error = warp::Rejection> + Clone {
   |   

because we have merged the PR replacing the Warp API implementation with the new Axum implementation.

josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 2, 2023
@josecelano josecelano linked a pull request Feb 2, 2023 that will close this issue
@josecelano
Copy link
Member Author

This will be fixed with #160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant