DEAD_CODE_PUB_IN_BINARY in rustc_lint_defs::builtin - Rust
Description: The `dead_code_pub_in_binary` lint detects unused `pub` items in executable crates.

Skip to main content

## DEAD_CODE_PUB_IN_BINARY

# Static DEAD_CODE_PUB_IN_BINARY

Source

    pub static DEAD_CODE_PUB_IN_BINARY: &Lint

Expand description

The `dead_code_pub_in_binary` lint detects unused `pub` items in executable crates.

#### §Example

    #![deny(dead_code_pub_in_binary)]

    pub fn unused_pub_fn() {}

    fn main() {}

{{produces}}

#### §Explanation

In executable crates, `pub` items are often implementation details rather than part of an external API. This lint helps find those items when they are never used.

This lint only applies to executable crates. In library crates, public items are considered part of the crate’s API and are not reported by this lint.