Skip to content

Fix opaque type warnings #148

@josecelano

Description

@josecelano

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.com-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.com-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.com-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.com-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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions