rustc_lint_defs::builtin

Static REDUNDANT_LIFETIMES

Source
pub static REDUNDANT_LIFETIMES: &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.