REDUNDANT_LIFETIMES in rustc_lint::builtin - Rust
Description: The `redundant_lifetimes` lint detects lifetime parameters that are redundant because they are equal to another named lifetime.

Skip to main content

## REDUNDANT_LIFETIMES

# Static REDUNDANT_LIFETIMES

Source

    pub static REDUNDANT_LIFETIMES: &'static Lint

Expand description

The `redundant_lifetimes` lint detects lifetime parameters that are redundant because they are equal to another named lifetime.

#### §Example

ⓘ

    #[deny(redundant_lifetimes)]

    // `'a = 'static`, so all usages of `'a` can be replaced with `'static`
    pub fn bar<'a: 'static>() {}

    // `'a = 'b`, so all usages of `'b` can be replaced with `'a`
    pub fn bar<'a: 'b, 'b: 'a>() {}

{{produces}}

#### §Explanation

Unused lifetime parameters may signal a mistake or unfinished code. Consider removing the parameter.