RS.CLIPPY.EXTRA_UNUSED_LIFETIMES

Unused lifetimes in function definitions

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: extra_unused_lifetimes. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for lifetimes in generics that are never used anywhere else.

Why is this bad?

The additional lifetimes make the code look more complicated, while there is nothing out of the ordinary going on. Removing them leads to more readable code.

Example

// unnecessary lifetimes
fn unused_lifetime<\'a>(x: u8) {
    // ..
}

Use instead:

fn no_lifetime(x: u8) {
    // ...
}