Skip to content

'cargo test --features http2' fails with many "associated function is never used" #2794

Closed
@RalfJung

Description

@RalfJung

Version
Current git master

Platform
Linux 5.16.0-4-amd64 #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08) x86_64 GNU/Linux

Description
Running cargo test --features http2 fails with a bunch of errors:

error: unused import: `self::never::Never`
  --> src/common/mod.rs:32:16
   |
32 | pub(crate) use self::never::Never;
   |                ^^^^^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:5:24
   |
5  | #![cfg_attr(test, deny(warnings))]
   |                        ^^^^^^^^
   = note: `#[deny(unused_imports)]` implied by `#[deny(warnings)]`

error: variant is never constructed: `Body`
  --> src/error.rs:52:5
   |
52 |     Body,
   |     ^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:5:24
   |
5  | #![cfg_attr(test, deny(warnings))]
   |                        ^^^^^^^^
   = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
note: `Kind` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  --> src/error.rs:20:10
   |
20 | #[derive(Debug)]
   |          ^^^^^
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error: variant is never constructed: `BodyWrite`
  --> src/error.rs:55:5
   |
55 |     BodyWrite,
   |     ^^^^^^^^^
   |
note: `Kind` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  --> src/error.rs:20:10
   |
20 | #[derive(Debug)]
   |          ^^^^^
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error: associated function is never used: `new_body`
   --> src/error.rs:298:19
    |
298 |     pub(super) fn new_body<E: Into<Cause>>(cause: E) -> Error {
    |                   ^^^^^^^^

error: associated function is never used: `new_body_write`
   --> src/error.rs:303:19
    |
303 |     pub(super) fn new_body_write<E: Into<Cause>>(cause: E) -> Error {
    |                   ^^^^^^^^^^^^^^

error: associated function is never used: `from_inner`
  --> src/ext.rs:34:19
   |
34 |     pub(crate) fn from_inner(inner: h2::ext::Protocol) -> Self {
   |                   ^^^^^^^^^^

error: associated function is never used: `into_inner`
  --> src/ext.rs:38:19
   |
38 |     pub(crate) fn into_inner(self) -> h2::ext::Protocol {
   |                   ^^^^^^^^^^

error: struct is never constructed: `Pending`
   --> src/upgrade.rs:109:19
    |
109 | pub(super) struct Pending {
    |                   ^^^^^^^

error: function is never used: `pending`
   --> src/upgrade.rs:114:15
    |
114 | pub(super) fn pending() -> (Pending, OnUpgrade) {
    |               ^^^^^^^

error: associated function is never used: `fulfill`
   --> src/upgrade.rs:235:19
    |
235 |     pub(super) fn fulfill(self, upgraded: Upgraded) {
    |                   ^^^^^^^

error: variant is never constructed: `Default`
  --> src/common/exec.rs:34:5
   |
34 |     Default,
   |     ^^^^^^^
   |
note: `Exec` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
  --> src/common/exec.rs:32:10
   |
32 | #[derive(Clone)]
   |          ^^^^^
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error: variant is never constructed: `Executor`
  --> src/common/exec.rs:35:5
   |
35 |     Executor(Arc<dyn Executor<BoxSendFuture> + Send + Sync>),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: `Exec` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
  --> src/common/exec.rs:32:10
   |
32 | #[derive(Clone)]
   |          ^^^^^
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error: associated function is never used: `execute`
  --> src/common/exec.rs:41:19
   |
41 |     pub(crate) fn execute<F>(&self, fut: F)
   |                   ^^^^^^^

error: associated function is never used: `extra_mut`
   --> src/body/body.rs:237:8
    |
237 |     fn extra_mut(&mut self) -> &mut Extra {
    |        ^^^^^^^^^

error: associated function is never used: `is_exact`
  --> src/body/length.rs:78:19
   |
78 |     pub(crate) fn is_exact(&self) -> bool {
   |                   ^^^^^^^^

error: could not compile `hyper` due to 15 previous errors

Looks like the #![cfg_attr(test, deny(warnings))] is a bit overeager here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions