hunger / downloader

Simple HTTP/HTTPS file downloader crate.
27 stars 10 forks source link

cargo test should include all features #25

Open rgreinho opened 2 years ago

rgreinho commented 2 years ago

When running the tests with cargo test --all-features, we can see that they fail due to a lifetime issue:

error[E0759]: `message` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/progress.rs:124:34
    |
117 |         fn setup(&self, max_progress: Option<u64>, message: &str) {
    |                                                             ---- this data with an anonymous lifetime `'_`...
...
124 |                 lock.set_message(message);
    |                                  ^^^^^^^ ...is used here...
    |
note: ...and is required to live as long as `'static` here
   --> src/progress.rs:124:22
    |
124 |                 lock.set_message(message);
    |                      ^^^^^^^^^^^

error[E0759]: `message` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/progress.rs:142:34
    |
117 |         fn setup(&self, max_progress: Option<u64>, message: &str) {
    |                                                             ---- this data with an anonymous lifetime `'_`...
...
142 |                 lock.set_message(message)
    |                                  ^^^^^^^ ...is used here...
    |
note: ...and is required to live as long as `'static` here
   --> src/progress.rs:142:22
    |
142 |                 lock.set_message(message)
    |                      ^^^^^^^^^^^

error[E0759]: `message` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/progress.rs:153:30
    |
151 |         fn set_message(&self, message: &str) {
    |                                        ---- this data with an anonymous lifetime `'_`...
152 |             let lock = self.progress_bar.lock().unwrap();
153 |             lock.set_message(message);
    |                              ^^^^^^^ ...is used here...
    |
note: ...and is required to live as long as `'static` here
   --> src/progress.rs:153:18
    |
153 |             lock.set_message(message);
    |                  ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0759`.
error: could not compile `downloader` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

This error was not caught by the CI because not all the features where tested by cargo test.

Also, running the TUI example cargo run --example tui_basic --features tui fails with the same error.